[LeetCode] 值得一做的题目列表
Summaries LeetCode
Lastmod: 2020-10-01 周四 19:53:03

总结一下 LeetCode 上比较好的题目(部分题可能并不是很好,但是实现细节复杂,面试需要特别注意也囊括进来了)。

推荐指数 $1-5$ 是按照可能已经掌握的知识层次进行排序的,竞赛选手推荐刷推荐指数 $3$ 以上的题目。推荐指数和难度存在个人差,仅供参考。

1 - 50

题号 题目 Tag 难度 推荐指数
1 Two Sum hash_map / 二分 / Two Pointers E- 1
2 Add Two Numbers 大数加法 E- 1
3 Longest Substring Without Repeating Characters Two Pointers E+ 3
4 Median of Two Sorted Arrays 二分 H 5
5 Longest Palindromic Substring Manacher M 3
8 String to Integer (atoi) Parser M 1
10 Regular Expression Matching DP M+ 5
11 Container With Most Water Two Pointers M- 5
12 Integer to Roman Parser E+ 2
16 3Sum Closest Two Pointers M+ 5
17 Letter Combinations of a Phone Number DFS E+ 2
20 Valid Parentheses Stack E- 1
21 Merge Two Sorted Lists Linked List E- 1
22 Generate Parentheses DFS E 2
23 Merge k Sorted Lists Heap M 3
25 Reverse Nodes in k-Group Linked List M+ 4
26 Remove Duplicates from Sorted Array Two Pointers E- 2
28 Implement strStr() KMP M- 3
29 Divide Two Integers 快速幂 M- 3
30 Substring with Concatenation of All Words KMP DP H 4
31 Next Permutation Ad hoc M 4
32 Longest Valid Parentheses DP M 3
33 Search in Rotated Sorted Array 二分 M- 4
34 Find First and Last Position of Element in Sorted Array 二分 E+ 2
37 Sudoku Solver DFS / DLX M/H+ 3
39 Combination Sum DFS E+ 2
40 Combination Sum II DFS M- 3
41 First Missing Positive Ad hoc M- 3
42 Trapping Rain Water 单调栈 / Two Pointers M+ 5
43 Multiply Strings 大数乘法 E+ 3
44 Wildcard Matching DP M+ 5
45 Jump Game II DP / BFS M- 2
46 Permutations DFS M- 3
47 Permutations II DFS M- 3
48 Rotate Image Ad hoc M- 2
50 Pow(x, n) 快速幂 E 2

51-100

题号 题目 Tag 难度 推荐指数
51 N-Queens DFS Bitmask E 3
53 Maximum Subarray DP E 3
56 Merge Intervals 扫描线 E 3
57 Insert Interval 扫描线 M 4
60 Permutation Sequence DFS / 康托展开 E / H 5
62 Unique Paths 组合数学 E 1
63 Unique Paths II DP E 2
65 Valid Number Parser M+ 3
68 Text Justification 字符串处理 M 2
70 Climbing Stairs 递推 E- 1
71 Simplify Path Stack E 2
72 Edit Distance DP H- 3
73 Set Matrix Zeroes Ad-hoc E 1
75 Sort Colors Ad-hoc M 3
76 Minimum Window Substring Two Pointers M 3
77 Combinations DFS E 2
78 Subsets DFS / Bitmask E 2
79 Word Search DFS E+ 2
82 Remove Duplicates from Sorted List II Linked List M 3
84 Largest Rectangle in Histogram 单调栈 M+ 4
85 Maximal Rectangle 单调栈 DP H- 5
87 Scramble String DFS M+ 3
89 Gray Code Ad-hoc 分治 E+ 2
90 Subsets II DFS E 2
91 Decode Ways DP E+ 1
93 Restore IP Addresses DFS M- 2
94 Binary Tree Inorder Traversal 中序遍历 / Morris E- / M 1/3
95 Unique Binary Search Trees II DFS M 3
96 Unique Binary Search Trees DP / Catalan M- 3
97 Interleaving String DP M- 3
98 Validate Binary Search Tree DFS E 2
99 Recover Binary Search Tree DFS M 3
100 Same Tree DFS E 1

101-150

题号 题目 Tag 难度 推荐指数
101 Symmetric Tree DFS E 1
103 Binary Tree Zigzag Level Order Traversal DFS/BFS E+ 2
104 Maximum Depth of Binary Tree DFS E 1
105 Construct Binary Tree from Preorder and Inorder Traversal 二叉树 M 4
106 Construct Binary Tree from Inorder and Postorder Traversal 二叉树 M 4
107 Binary Tree Level Order Traversal II DFS/BFS E 2
108 Convert Sorted Array to Binary Search Tree BST M- 3
109 Convert Sorted List to Binary Search Tree BST M 3
110 Balanced Binary Tree BST E- 1
113 Path Sum II 遍历 E- 1
114 Flatten Binary Tree to Linked List 遍历 M 3
115 Distinct Subsequences DP M+ 4
117 Populating Next Right Pointers in Each Node II BFS M 4
118 Pascal’s Triangle 组合数学 E 1
119 Pascal’s Triangle II 组合数学 M- 2
120 Triangle DP E 2
121 Best Time to Buy and Sell Stock DP/贪心 E 2
122 Best Time to Buy and Sell Stock II 贪心 M- 3
123 Best Time to Buy and Sell Stock III DP M+ 5
124 Binary Tree Maximum Path Sum 树状DP M 5
126 Word Ladder II BFS/DFS H- 3
127 Word Ladder BFS/DFS M 3
128 Longest Consecutive Sequence 并查集/hash H- 5
130 Surrounded Regions BFS/DFS E+ 3
131 Palindrome Partitioning DFS E+ 2
132 Palindrome Partitioning II DP M+ 4
133 Clone Graph DFS M 5
134 Gas Station 贪心 H- 5
135 Candy 贪心 M 4
136 Single Number Bitmask E 3
137 Single Number II Bitmask H- 5
138 Copy List with Random Pointer DFS M 4
139 Word Break DFS Trie M+ 4
140 Word Break II DFS Trie M+ 4
141 Linked List Cycle Ad hoc M- 5
142 Linked List Cycle II Ad hoc H- 5
144 Binary Tree Preorder Traversal 遍历 E- 2
145 Binary Tree Postorder Traversal 遍历 E- 2
146 LRU Cache Linkedlist H- 5
148 Sort List Sort M 3
149 Max Points on a Line 计算几何 M+ 3
150 Evaluate Reverse Polish Notation Stack M- 3

151-200

题号 题目 Tag 难度 推荐指数
152 Maximum Product Subarray DP M 5
153 Find Minimum in Rotated Sorted Array 二分 M 4
155 Min Stack 单调栈 M- 5
156 Binary Tree Upside Down Ad hoc M+ 3
157 Read N Characters Given Read4 Ad hoc M- 2
158 Read N Characters Given Read4 II - Call multiple times Ad hoc H- 3
159 Longest Substring with At Most Two Distinct Characters Two Pointers E+ 3
160 Intersection of Two Linked Lists Ad hoc E+ 3
Prev: [模板][Hash] 安全哈希函数
Next: [模板] C++ 日常使用