1 |
The Sum of |
2 |
5 |
Array + Set |
Sort + pointers |
2 |
ADD Numbers |
3 |
4 |
Linked list |
Pointers + Math |
3 |
Longest Substring without repeating characters |
3 |
2 |
String + hashtable |
Pointers |
4 |
Median of Sorted Arrays |
5 |
3 |
Array |
Binary search |
5 |
Longest palindromic Substring |
4 |
2 |
String |
|
6 |
ZigZag Conversion |
3 |
1 |
String |
|
7 |
Reverse Integer |
2 |
3 |
|
Math |
8 |
String to Integer (atoi) |
2 |
5 |
String |
Math |
9 |
Palindrome number |
2 |
2 |
|
Math |
10 |
Regular Expression Matching |
5 |
3 |
String |
Recursion + DP |
11 |
Container with most water |
3 |
2 |
Array |
Pointers |
12 |
Integer to Roman |
3 |
4 |
|
Math |
13 |
Roman to Integer |
2 |
4 |
|
Math |
14 |
Longest Common Prefix |
2 |
1 |
String |
|
15 |
3Sum |
3 |
5 |
Array |
Pointers |
16 |
3Sum Closest |
3 |
1 |
Array |
Pointers |
17 |
Letter combinations of a Phone number |
3 |
3 |
String |
Dfs |
18 |
4Sum |
3 |
2 |
Array |
|
19 |
Remove Nth Node from End of List |
2 |
3 |
Linked list |
Pointers |
20 |
Valid parentheses |
2 |
5 |
String |
Stack |
21st |
Merge Sorted Lists |
2 |
5 |
Linked list |
Sort + pointers + merge |
22 |
Generate parentheses |
3 |
4 |
String |
Dfs |
23 |
Merge k Sorted Lists |
3 |
4 |
Linked list + heap |
Sort + pointers + merge |
24 |
Swap Nodes in Pairs |
2 |
4 |
Linked list |
|
25 |
Reverse Nodes in K-group |
4 |
2 |
Linked list |
Recursion + pointers |
26 |
Remove Duplicates from Sorted Array |
1 |
3 |
Array |
Pointers |
27 |
Remove Element |
1 |
4 |
Array |
Pointers |
28 |
Implement StrStr () |
4 |
5 |
String |
Pointers + KMP + rolling Hash |
29 |
Divide integers |
4 |
3 |
|
Binary search + Math |
30 |
Substring with concatenation of all Words |
3 |
1 |
String |
Pointers |
31 |
Next permutation |
5 |
2 |
Array |
Permutation |
32 |
Longest Valid parentheses |
4 |
1 |
String |
Dp |
33 |
Search in rotated Sorted Array |
4 |
3 |
Array |
Binary search |
34 |
Search for a Range |
4 |
3 |
Array |
Binary search |
35 |
Search Insert Position |
2 |
2 |
Array |
|
36 |
Valid Sudoku |
2 |
2 |
Array |
|
37 |
Sudoku Solver |
4 |
2 |
Array |
Dfs |
38 |
Count and Say |
2 |
2 |
String |
Pointers |
39 |
Combination Sum |
3 |
3 |
Array |
Combination |
40 |
Combination Sum II |
4 |
2 |
Array |
Combination |
41 |
First Missing Positive |
5 |
2 |
Array |
Sort |
42 |
Trapping Rain Water |
4 |
2 |
Array |
Pointers + Stack |
43 |
Multiply Strings |
4 |
3 |
String |
Pointers + Math |
44 |
Wildcard Matching |
5 |
3 |
String |
Recursion + DP + greedy |
45 |
Jump Game II |
4 |
2 |
Array |
|
46 |
Permutations |
3 |
4 |
Array |
Permutation |
47 |
Permutations II |
4 |
2 |
Array |
Permutation |
48 |
Rotate Image |
4 |
2 |
Array |
|
49 |
Anagrams |
3 |
4 |
String + hashtable |
|
50 |
Pow (x, N) |
3 |
5 |
|
Binary search + Math |
51 |
N-queens |
4 |
3 |
Array |
Dfs |
52 |
N-queens II |
4 |
3 |
Array |
Dfs |
53 |
Maximum Subarray |
3 |
3 |
Array |
Dp |
54 |
Spiral Matrix |
4 |
2 |
Array |
|
55 |
Jump Game |
3 |
2 |
Array |
|
56 |
Merge intervals |
4 |
5 |
Array + linked list + Red-black tree |
Sort + Merge |
57 |
Insert Interval |
4 |
5 |
Array + linked list + Red-black tree |
Sort + Merge |
58 |
Length of last Word |
1 |
1 |
String |
|
59 |
Spiral Matrix II |
3 |
2 |
Array |
|
60 |
Permutation Sequence |
5 |
1 |
|
Permutation + Math |
61 |
Rotate List |
3 |
2 |
Linked list |
Pointers |
62 |
Unique Paths |
2 |
3 |
Array |
Dp |
63 |
Unique Paths II |
3 |
3 |
Array |
Dp |
64 |
Minimum Path Sum |
3 |
3 |
Array |
Dp |
65 |
Valid number |
2 |
5 |
String |
Math |
66 |
Plus One |
1 |
2 |
Array |
Math |
67 |
ADD Binary |
2 |
4 |
String |
Pointers + Math |
68 |
Text Justification |
4 |
2 |
String |
|
69 |
SQRT (x) |
4 |
4 |
|
Binary search |
70 |
Climbing stairs |
2 |
5 |
|
Dp |
71 |
Simplify Path |
3 |
1 |
String |
Stack |
72 |
Edit Distance |
4 |
3 |
String |
Dp |
73 |
Set Matrix Zeroes |
3 |
5 |
Array |
|
74 |
Search a 2D Matrix |
3 |
3 |
Array |
Binary search |
75 |
Sort Colors |
4 |
2 |
Array |
Sort + pointers |
76 |
Minimum Window Substring |
4 |
2 |
String |
Pointers |
77 |
Combinations |
3 |
4 |
|
Combination |
78 |
Subsets |
3 |
4 |
Array |
Recursion + combination |
79 |
Word Search |
3 |
4 |
Array |
Dfs |
80 |
Remove duplicates from Sorted Array II |
2 |
2 |
Array |
Pointers |
81 |
Search in rotated Sorted Array II |
5 |
3 |
Array |
Binary search |
82 |
Remove duplicates from Sorted List II |
3 |
3 |
Linked list |
Recursion + pointers |
83 |
Remove Duplicates from Sorted List |
1 |
3 |
Linked list |
|
84 |
Largest Rectangle in histogram |
5 |
2 |
Array |
Stack |
85 |
Maximal Rectangle |
5 |
1 |
Array |
DP + Stack |
86 |
Partition List |
3 |
3 |
Linked list |
Pointers |
87 |
Scramble String |
5 |
2 |
String |
Recursion + DP |
88 |
Merge Sorted Array |
2 |
5 |
Array |
Pointers + Merge |
89 |
Gray Code |
4 |
2 |
|
Combination |
90 |
Subsets II |
4 |
2 |
Array |
Recursion + combination |
91 |
Decode Ways |
3 |
4 |
String |
Recursion + DP |
92 |
Reverse Linked List II |
3 |
2 |
Linked list |
Pointers |
93 |
Restore IP Addresses |
3 |
3 |
String |
Dfs |
94 |
Binary Tree inorder Traversal |
4 |
3 |
Tree + Hashtable |
Recursion + Morris + stack |
95 |
Unique Binary Search Trees II |
4 |
1 |
Tree |
DP + DFS |
96 |
Unique Binary Search Trees |
3 |
1 |
Tree |
Dp |
97 |
Interleaving String |
5 |
2 |
String |
Recursion + DP |
98 |
Validate Binary Search Tree |
3 |
5 |
Tree |
Dfs |
99 |
Recover Binary Search Tree |
4 |
2 |
Tree |
Dfs |
100 |
Same Tree |
1 |
1 |
Tree |
Dfs |
101 |
Symmetric Tree |
1 |
2 |
Tree |
Dfs |
102 |
Binary Tree level Order traversal |
3 |
4 |
Tree |
BFs |
103 |
Binary Tree Zigzag level Order traversal |
4 |
3 |
Queue + Tree |
BFS + Stack |
104 |
Maximum Depth of Binary Tree |
1 |
1 |
Tree |
Dfs |
105 |
Construct Binary Tree from preorder and inorder Tr |
3 |
3 |
Array + Tree |
Dfs |
106 |
Construct Binary Tree from Inorder and Postorder T |
3 |
3 |
Array + Tree |
Dfs |
107 |
Binary Tree level Order traversal II |
3 |
1 |
Tree |
BFs |
108 |
Convert Sorted Array to Binary Search Tree |
2 |
3 |
Tree |
Dfs |
109 |
Convert Sorted List to Binary Search Tree |
4 |
3 |
Linked list |
Recursion + pointers |
110 |
Balanced Binary Tree |
1 |
2 |
Tree |
Dfs |
111 |
Minimum Depth of Binary Tree |
1 |
1 |
Tree |
Dfs |
112 |
Path Sum |
1 |
3 |
Tree |
Dfs |
113 |
Path Sum II |
2 |
2 |
Tree |
Dfs |
114 |
Flatten Binary Tree to Linked List |
3 |
3 |
Tree |
Recursion + stack |
115 |
Distinct subsequences |
4 |
2 |
String |
Dp |
116 |
Populating Next right pointers in each Node |
3 |
3 |
Tree |
Dfs |
117 |
Populating Next right pointers in each Node II |
4 |
2 |
Tree |
Dfs |
118 |
Pascal ' s Triangle |
2 |
1 |
Array |
|
119 |
Pascal ' s Triangle II |
2 |
1 |
Array |
|
120 |
Triangle |
3 |
1 |
Array |
Dp |
121 |
best time to Buy and Sell Stock |
2 |
1 |
Array |
Dp |
122 |
best time to Buy and Sell Stock II |
3 |
1 |
Array |
Greedy |
123 |
best time to Buy and Sell Stock III |
4 |
1 |
Array |
Dp |
124 |
Binary Tree Maximum Path Sum |
4 |
2 |
Tree |
Dfs |
125 |
Valid palindrome |
2 |
5 |
String |
Pointers |
126 |
Word Ladder II |
1 |
1 |
|
|
127 |
Word Ladder |
3 |
5 |
Graph |
BFS + Shortest Path |
128 |
Longest consecutive Sequence |
4 |
3 |
Array |
|
129 |
Sum Root to Leaf Numbers |
2 |
4 |
Tree |
Dfs |
130 |
Surrounded regions |
4 |
3 |
Array |
BFS + DFS |
131 |
Palindrome Partitioning |
3 |
4 |
String |
Dfs |
132 |
Palindrome Partitioning II |
4 |
3 |
String |
Dp |