Up to date (2015-07-18), there are 248
problems on LintCode Online Judge.
The number of problems is increasing recently.
Here is the classification of all 248
problems.
For extra problems and solutions, you can see my LeetCode repository.
I'll keep updating for full summary and better solutions. Stay tuned for updates.
- Bit Manipulation
- Array
- String
- Linked List
- Math
- Tree
- Stack
- Queue
- Heap
- Hash Tables
- Data Structure
- Sort
- Divide and Conquer
- Binary Search
- Depth First Search
- Breadth First Search
- Binary Search Trees
- Dynamic Programming
- Greedy
- OO Design
##Bit Manipulation
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
1 | A + B Problem | C++ | O(1) | O(1) | Hard | ||
82 | Single Number | C++ | O(n) | O(1) | Easy | LeetCode | |
83 | Single Number II | C++ | O(n) | O(1) | Easy | LeetCode | |
84 | Single Number III | C++ | O(n) | O(1) | Medium | CTCI | |
142 | O(1) Check Power of 2 | C++ | O(1) | O(1) | Easy | ||
179 | Update Bits | C++ | O(1) | O(1) | Medium | CTCI | |
181 | Flip Bits | C++ | O(1) | O(1) | Easy | CTCI | |
196 | Find the Missing Number | C++ | O(n) | O(1) | Medium | ||
365 | Count 1 in Binary | C++ | O(m) | O(1) | Easy | CTCI |
##Array
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
6 | Merge Sorted Array | C++ | O(m + n) | O(1) | Easy | LeetCode | Two Pointers |
8 | Rotate String | C++ | O(n) | O(1) | Easy | LeetCode | |
9 | Fizz Buzz | C++ | O(n) | O(1) | Easy | ||
30 | Insert Interval | C++ | O(n) | O(1) | Easy | LeetCode, EPI | |
31 | Partition Array | C++ | O(n) | O(1) | Medium | Two Pointers | |
32 | Minimum Window Substring | C++ | O(n) | O(1) | Medium | LeetCode | |
38 | Search a 2D Matrix II | C++ | O(m + n) | O(1) | Medium | EPI | |
39 | Recover Rotated Sorted Array | C++ | O(n) | O(1) | Easy | ||
46 | Majority Number | C++ | O(n) | O(1) | Easy | LeetCode | |
47 | Majority Number II | C++ | O(n) | O(1) | Medium | EPI | |
48 | Majority Number III | C++ | O(n) | O(k) | Medium | EPI | |
49 | Sort Letters by Case | C++ | O(n) | O(1) | Medium | Two Pointers | |
50 | Product of Array Exclude Itself | C++ | O(n) | O(1) | Easy | ||
51 | Previous Permutation | C++ | O(n) | O(1) | Medium | ||
52 | Next Permutation | C++ | O(n) | O(1) | Medium | LeetCode | |
57 | 3 Sum | C++ | O(n^2) | O(1) | Medium | LeetCode | Two Pointers, Sort |
59 | 3 Sum Closest | C++ | O(n^2) | O(1) | Medium | LeetCode | Two Pointers, Sort |
64 | Merge Sorted Array II | C++ | O(m + n) | O(1) | Easy | LeetCode | Two Pointers |
100 | Remove Duplicates from Sorted Array | C++ | O(n) | O(1) | Easy | LeetCode | Two Pointers |
101 | Remove Duplicates from Sorted Array II | C++ | O(n) | O(1) | Easy | LeetCode | Two Pointers |
133 | Longest Words | C++ | O(n) | O(n) | Easy | ||
144 | Interleaving Positive and Negative Numbers | C++ | O(n) | O(1) | Medium | Two Pointers | |
161 | Rotate Image | C++ | O(n^2) | O(1) | Medium | LeetCode | |
162 | Set Matrix Zeroes | C++ | O(m * n) | O(1) | Medium | LeetCode | |
172 | Remove Element | C++ | O(n) | O(1) | Easy | LeetCode | Two Pointers |
185 | Matrix Zigzag Traversal | C++ | O(m * n) | O(1) | Easy | ||
189 | First Missing Positive | C++ | O(n) | O(1) | Easy | LeetCode, EPI | Hash |
190 | Next Permutation II | C++ | O(n) | O(1) | Medium | LeetCode | |
200 | Longest Palindromic Substring | C++ | O(n) | O(n) | Medium | LeetCode | Manacher's Algorithm |
363 | Trapping Rain Water | C++ | O(n) | O(1) | Medium | LeetCode | Two Pointers, Tricky |
373 | Partition Array by Odd and Even | C++ | O(n) | O(1) | Easy | Two Pointers | |
382 | Triangle Count | C++ | O(n^2) | O(1) | Medium | Two Pointers | |
383 | Container With Most Water | C++ | O(n) | O(1) | Medium | LeetCode, EPI | Two Pointers |
388 | Permutation Sequence | C++ | O(n^2) | O(n) | Medium | LeetCode | |
389 | Valid Sudoku | C++ | O(9^2) | O(9) | Easy | LeetCode | |
404 | Subarray Sum II | C++ | O(nlogn) | O(n) | Hard | Two Pointers, Binary Search | |
405 | Submatrix Sum | C++ | O(m * n^2) | O(m) | Hard | Hash | |
406 | Minimum Size Subarray Sum | C++ | O(n) | O(1) | Medium | LeetCode | Two Pointers, Binary Search |
##String
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
13 | strStr | C++ | O(n) | O(k) | Easy | LeetCode | KMP Algorithm |
53 | Reverse Words in a String | C++ | O(n) | O(1) | Easy | LeetCode, EPI | |
54 | String to Integer(atoi) | C++ | O(n) | O(1) | Hard | LeetCode | |
55 | Compare Strings | C++ | O(n) | O(c) | Easy | ||
78 | Longest Common Prefix | C++ | O(n) | O(1) | Medium | ||
157 | Unique Characters | C++ | O(n) | O(1) | Easy | CTCI | |
158 | Two Strings Are Anagrams | C++ | O(n) | O(1) | Easy | ||
171 | Anagrams | C++ | O(n * klogk) | O(m) | Easy | LeetCode, EPI | |
212 | Space Replacement | C++ | O(n) | O(1) | Easy | ||
407 | Plus One | C++ | O(n) | O(1) | Easy | LeetCode | |
408 | Add Binary | C++ | O(n) | O(1) | Easy | LeetCode | |
415 | Valid Palindrome | C++ | O(n) | O(1) | Easy | LeetCode | |
417 | Valid Number | C++ | O(n) | O(1) | Hard | LeetCode | Automata |
420 | Count and Say | C++ | O(n * 2^n) | O(2^n) | Easy | LeetCode |
##Linked List
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
16 | Merge Two Sorted Lists | C++ | O(n) | O(1) | Easy | LeetCode, EPI | |
35 | Reverse Linked List | C++ | O(n) | O(1) | Easy | LeetCode, EPI | |
36 | Reverse Linked List II | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
96 | Partition List | C++ | O(n) | O(1) | Easy | LeetCode | |
98 | Sort List | C++ | O(nlogn) | O(logn) | Medium | LeetCode, EPI | |
99 | Reorder List | C++ | O(n) | O(1) | Medium | LeetCode | |
102 | Linked List Cycle | C++ | O(n) | O(1) | Medium | LeetCode | |
103 | Linked List Cycle II | C++ | O(n) | O(1) | Hard | LeetCode | |
105 | Copy List with Random Pointer | C++ | O(n) | O(1) | Medium | LeetCode | |
106 | Convert Sorted List to Binary Search Tree | C++ | O(n) | O(logn) | Medium | LeetCode, EPI | |
112 | Remove Duplicates from Sorted List | C++ | O(n) | O(1) | Easy | LeetCode, EPI | |
113 | Remove Duplicates from Sorted List II | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
166 | Nth to Last Node in List | C++ | O(n) | O(1) | Easy | LeetCode | |
167 | Two Lists Sum | C++ | O(n) | O(1) | Easy | LeetCode | |
170 | Rotate List | C++ | O(n) | O(1) | Medium | LeetCode | |
173 | Insertion Sort List | C++ | O(n^2) | O(1) | Easy | LeetCode | |
174 | Remove Nth Node From End of List | C++ | O(n) | O(1) | Easy | LeetCode | |
372 | Delete Node in the Middle of Singly Linked List | C++ | O(1) | O(1) | Easy | CTCI | |
422 | Length of Last Word | C++ | O(n) | O(1) | Easy | LeetCode |
##Tree
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
85 | Insert Node in a Binary Search Tree | C++ | O(h) | O(1) | Easy | ||
88 | Lowest Common Ancestor | C++ | O(n) | O(h) | Medium | EPI | |
127 | Max Tree | C++ | O(n) | O(n) | Hard | ||
175 | Invert Binary Tree | C++ | O(n) | O(h) | Easy | LeetCode |
##Stack
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
12 | Min Stack | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
40 | Implement Queue by Two Stacks | C++ | O(1), amortized | O(n) | Medium | EPI | |
66 | Binary Tree Preorder Traversal | C++ | O(n) | O(1) | Easy | LeetCode, EPI | Morris Traversal |
67 | Binary Tree Inorder Traversal | C++ | O(n) | O(1) | Easy | LeetCode, EPI | Morris Traversal |
68 | Binary Tree Postorder Traversal | C++ | O(n) | O(1) | Easy | LeetCode, EPI | Morris Traversal |
122 | Largest Rectangle in Histogram | C++ | O(n) | O(n) | Hard | LeetCode, EPI | |
367 | Expression Tree Build | C++ | O(n) | O(n) | Hard | ||
368 | Expression Evaluation | C++ | O(n) | O(n) | Hard | ||
369 | Convert Expression to Polish Notation | C++ | O(n) | O(n) | Hard | ||
370 | Convert Expression to Reverse Polish Notation | C++ | O(n) | O(n) | Hard | ||
421 | Simplify Path | C++ | O(n) | O(n) | Medium | LeetCode | |
423 | Valid Parentheses | C++ | O(n) | O(n) | Easy | LeetCode | |
424 | Evaluate Reverse Polish Notation | C++ | O(n) | O(n) | Medium | LeetCode |
##Queue
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
362 | Sliding Window Maximum | C++ | O(n) | O(k) | Hard | EPI | Deque, Tricky |
##Heap
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
4 | Ugly Number | C++ | O(k) | O(1) | Medium | CTCI | |
81 | Median in Data Stream | C++ | O(nlogn) | O(n) | Hard | EPI | BST, Heap |
104 | Merge k Sorted Lists | C++ | O(n * logk) | O(k) | Medium | LeetCode | |
130 | Heapify | C++ | O(n) | O(1) | Medium | ||
364 | Trapping Rain Water II | C++ | O(m * n * (logm + logn)) | O(m * n) | Hard | BFS, Heap, Tricky |
##Hash Tables
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
56 | 2 Sum | C++ | O(n) | O(n) | Medium | LeetCode | |
58 | 4 Sum | C++ | O(n^2 * p) | O(n^2 * p) | Medium | LeetCode | Hash |
124 | Longest Consecutive Sequence | C++ | O(n) | O(n) | Medium | LeetCode, EPI | |
128 | Hash Function | C++ | O(n) | O(1) | Easy | ||
129 | Rehashing | C++ | O(n) | O(n) | Medium | ||
138 | Subarray Sum | C++ | O(n) | O(n) | Easy | ||
186 | Max Points on a Line | C++ | O(n^2) | O(n) | Medium | LeetCode | |
384 | Longest Substring Without Repeating Characters | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
386 | Longest Substring with At Most K Distinct Characters | C++ | O(n) | O(n) | Medium | ||
432 | Find the Weak Connected Component in the Directed Graph | C++ | O(nlogn) | O(n) | Medium | Union Find | |
434 | Number of Islands II | C++ | O(p) | O(p) | Hard | Union Find |
##Data Structure
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
134 | LRU Cache | C++ | O(1) | O(c) | Hard | LeetCode, EPI | List, Hash |
##Math
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2 | Trailing Zeros | C++ | O(logn) | O(1) | Easy | LeetCode | |
3 | Digit Counts | C++ | O(logn) | O(1) | Medium | CTCI | |
114 | Unique Paths | C++ | O(min(m, n)) | O(1) | Easy | LeetCode, CTCI | DP, Math |
163 | Unique Binary Search Trees | C++ | O(n) | O(1) | Medium | CTCI | DP, Math, Catalan Number |
180 | Binary Represention | C++ | O(1) | O(1) | Hard | CTCI | |
394 | Coins in a Line | C++ | O(1) | O(1) | Easy | ||
411 | Gray Code | C++ | O(2^n) | O(1) | Medium | LeetCode | |
413 | Reverse Integer | C++ | O(logn) | O(1) | Medium | LeetCode | |
414 | Divide Two Integer | C++ | O(logn) | O(1) | Medium | LeetCode |
##Sort
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
5 | Kth Largest Element | C++ | O(n) | O(1) | Medium | EPI | Two Pointers, Quick Sort |
80 | Median | C++ | O(n) | O(1) | Easy | EPI | |
139 | Subarray Sum Closest | C++ | O(nlogn) | O(n) | Medium | Sort | |
143 | Sort Colors II | C++ | O(n) | O(1) | Medium | ||
148 | Sort Colors | C++ | O(n) | O(1) | Medium | LeetCode | |
156 | Merge Intervals | C++ | O(nlogn) | O(1) | Easy | LeetCode, EPI | |
184 | Largest Number | C++ | O(nlogn) | O(1) | Medium | LeetCode | |
366 | Fibonacci | C++ | O(n) | O(1) | Easy | ||
387 | The Smallest Difference | C++ | O(nlogn) | O(1) | Medium | Two Pointers | |
399 | Nuts & Bolts Problem (invalid link now) | C++ | O(nlogn) | O(1) | Medium | Quick Sort | |
400 | Maximum Gap | C++ Python | O(n) | O(n) | Hard | LeetCode | Bucket Sort |
418 | Integer to Roman | C++ | O(n) | O(1) | Medium | LeetCode | |
419 | Roman to Integer | C++ | O(n) | O(1) | Medium | LeetCode |
##Divide and Conquer
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
17 | Subsets | C++ | O(n * 2^n) | O(1) | Medium | LeetCode | |
18 | Subsets II | C++ | O(n * 2^n) | O(1) | Medium | LeetCode | |
72 | Construct Binary Tree from Inorder and Postorder Traversal | C++ | O(n) | O(h) | Medium | LeetCode, EPI | |
73 | Construct Binary Tree from Preorder and Inorder Traversal | C++ | O(n) | O(h) | Medium | LeetCode, EPI | |
93 | Balanced Binary Tree | C++ | O(n) | O(h) | Easy | LeetCode | |
94 | Binary Tree Maximum Path Sum | C++ | O(n) | O(h) | Medium | LeetCode | |
95 | Validate Binary Search Tree | C++ | O(n) | O(h) | Medium | LeetCode | |
97 | Maximum Depth of Binary Tree | C++ | O(n) | O(h) | Easy | LeetCode | |
131 | Building Outline | C++ Python | O(nlogn) | O(n) | Hard | EPI | Sort, BST |
140 | Fast Power | C++ | O(logn) | O(logn) | Medium | ||
155 | Minimum Depth of Binary Tree | C++ | O(n) | O(h) | Easy | LeetCode | |
164 | Unique Binary Search Trees II | C++ | O(n * 4^n / n^(3/2)) | O(n) | Medium | LeetCode | |
177 | Convert Sorted Array to Binary Search Tree With Minimal Height | C++ | O(n) | O(logn) | Easy | LeetCode | |
201 | Segment Tree Build | C++ | O(n) | O(h) | Medium | Segment Tree, BST | |
202 | Segment Tree Query | C++ | O(h) | O(h) | Medium | Segment Tree, BST | |
203 | Segment Tree Modify | C++ | O(h) | O(h) | Medium | Segment Tree, BST | |
205 | Interval Minimum Number | C++ | build tree: O(n), query: (h) | O(h) | Hard | Segment Tree, BST | |
206 | Interval Sum | C++ | build tree: O(n), query: O(h) | O(h) | Hard | Segment Tree, BST | |
207 | Interval Sum II | C++ | build tree: O(n), query: O(h), modify: O(h) | O(h) | Hard | Segment Tree, BST | |
245 | Subtree | C++ | O(m * n) | O(h) | Easy | ||
247 | Segment Tree Query II | C++ | O(h) | O(h) | Hard | Segment Tree, BST | |
248 | Count of Smaller Number | C++ | build tree: O(n), query: O(logn) | O(h) | Medium | Segment Tree, BST | |
371 | Print Numbers by Recursion | C++ | O(n) | O(n) | Medium | ||
425 | Letter Combinations of a Phone Number (invalid link now) | C++ | O(n * 4^n) | O(n) | Medium | LeetCode |
##Binary Search
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
14 | Binary Search | C++ | O(logn) | O(1) | Easy | ||
28 | Search a 2D Matrix | C++ | O(logm + logn) | O(1) | Easy | LeetCode | |
60 | Search Insert Position | C++ | O(logn) | O(1) | Easy | LeetCode | |
61 | Search for a Range | C++ | O(logn) | O(1) | Medium | LeetCode | |
62 | Search in Rotated Sorted Array | C++ | O(logn) | O(1) | Hard | LeetCode | |
63 | Search in Rotated Sorted Array II | C++ | O(logn) | O(1) | Medium | LeetCode | |
65 | Median of two Sorted Arrays | C++ | O(log(min(m, n))) | O(1) | Hard | LeetCode, EPI | Tricky |
74 | First Bad Version | C++ | O(logn) | O(1) | Medium | ||
75 | Find Peak Element | C++ | O(logn) | O(1) | Medium | LeetCode | |
76 | Longest Increasing Subsequence | C++ | O(nlogn) | O(n) | Medium | CTCI | |
141 | Sqrt(x) | C++ | O(logn) | O(1) | Easy | LeetCode | |
159 | Find Minimum in Rotated Sorted Array | C++ | O(logn) | O(1) | Medium | LeetCode | |
160 | Find Minimum in Rotated Sorted Array II | C++ | O(logn) | O(1) | Medium | LeetCode | |
183 | Wood Cut | C++ | O(nlogL) | O(1) | Medium | ||
249 | Count of Smaller Number before itself | C++ | O(nlogn) | O(h) | Hard | ||
390 | Find Peak Element II | C++ Java Python | O(m + n) | O(1) | Hard | ||
437 | Copy Books | C++ | O(nlogp) | O(1) | Hard | UVa 714 |
##Depth First Search
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
15 | Permutations | C++ | O(n * n!) | O(n) | Medium | LeetCode, EPI | |
16 | Permutations II | C++ | O(n * n!) | O(n) | Medium | LeetCode, EPI | |
33 | N-Queens | C++ | O(n * n!) | O(n) | Medium | LeetCode, EPI | |
34 | N-Queens II | C++ | O(n * n!) | O(n) | Medium | LeetCode, EPI | |
90 | K Sum II | C++ | O(k * C(n, k)) | O(k) | Medium | ||
123 | Word Search | C++ | O(m * n * l) | O(l) | Medium | LeetCode | |
132 | Word Search II | C++ | O(m * n * l) | O(l) | Hard | Trie, DFS | |
135 | Combination Sum | C++ | O(k * n^k) | O(k) | Medium | LeetCode | DFS |
136 | Palindrome Partitioning | C++ | O(2^n) | O(n) | Easy | LeetCode, EPI | |
152 | Combinations | C++ | O(k * n^k) | O(k) | Medium | LeetCode, EPI | |
153 | Combination Sum II | C++ | O(k * C(n, k)) | O(k) | Medium | LeetCode | DFS |
433 | Number of Islands | C++ | O(m * n) | O(m * n) | Easy | LeetCode | DFS |
##Breadth First Search
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
69 | Binary Tree Level Order Traversal | C++ | O(n) | O(n) | Medium | LeetCode | BFS |
70 | Binary Tree Level Order Traversal II | C++ | O(n) | O(n) | Medium | LeetCode | BFS |
71 | Binary Tree Zigzag Level Order Traversal | C++ | O(n) | O(n) | Medium | LeetCode | BFS |
120 | Word Ladder | C++ | O(n * d) | O(d) | Medium | LeetCode | BFS |
121 | Word Ladder II | C++ | O(n * d) | O(d) | Hard | LeetCode | BFS, Back Trace |
127 | Topological Sorting | C++ | O(|V|+|E|) | O(|E|) | Medium | DFS, BFS | |
137 | Clone Graph | C++ | O(|V|+|E|) | O(|V|) | Medium | BFS | |
176 | Route Between Two Nodes in Graph | C++ | O(n) | O(n) | Medium | DFS, BFS | |
431 | Find the Connected Component in the Undirected Graph | C++ | O(n) | O(n) | Easy | BFS |
##Binary Search Trees
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
7 | Binary Tree Serialization | C++ | O(n) | O(h) | Medium | LeetCode | |
11 | Search Range in Binary Search Tree | C++ | O(n) | O(h) | Medium | EPI | |
86 | Binary Search Tree Iterator | C++ | O(1) | O(h) | Hard | LeetCode | |
87 | Remove Node in Binary Search Tree | C++ | O(h) | O(h) | Hard | ||
360 | Sliding Window Median | C++ | O(nlogw) | O(w) | Hard | BST, Tricky | |
391 | Number of Airplanes in the Sky | C++ | O(nlogn) | O(1) | Easy | BST, Heap | |
401 | Kth Smallest Number in Sorted Matrix | C++ | O(klog(min(m, n, k))) | O(min(m, n, k)) | Medium | BST, Heap |
##Dynamic Programming
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
29 | Interleaving String | C++ | O(m * b) | O(min(m, n)) | Medium | EPI | |
43 | Maximum Subarray III | C++ | O(k * n^2) | O(k * n) | Hard | ||
77 | Longest Common Subsequence | C++ | O(m * n) | O(min(m, n)) | Medium | ||
79 | Longest Common Substring | C++ | O(m * n) | O(min(m, n)) | Medium | ||
89 | K Sum | C++ | O(k * n * t) | O(n * t) | Hard | ||
91 | Minimum Adjustment Cost | C++ | O(k * n * t) | O(k) | Medium | ||
92 | Backpack | C++ | O(m * n) | O(m) | Easy | ||
107 | Word Break | C++ | O(n^2) | O(n) | Medium | LeetCode, EPI | |
108 | Palindrome Partitioning II | C++ | O(n^2) | O(n) | Medium | LeetCode, EPI | |
109 | Triangle | C++ | O(n) | O(n) | Easy | LeetCode, EPI | |
110 | Minimum Path Sum | C++ | O(m * n) | O(min(m, n)) | Easy | LeetCode, EPI | |
111 | Climbing Stairs | C++ | O(n) | O(1) | Easy | LeetCode | |
115 | Unique Paths II | C++ | O(m * n) | O(min(m, n)) | Easy | LeetCode, CTCI | DP, Math |
118 | Distinct Subsequences | C++ | O(m * n) | O(m) | Medium | LeetCode | DP |
119 | Edit Distance | C++ | O(m * n) | O(min(m, n)) | Medium | LeetCode, CTCI | DP |
125 | Backpack II | C++ | O(m * n) | O(m) | Medium | ||
149 | Best Time to Buy and Sell Stock | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
150 | Best Time to Buy and Sell Stock II | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
151 | Best Time to Buy and Sell Stock III | C++ | O(n) | O(1) | Medium | LeetCode, EPI | |
154 | Regular Expression Matching | C++ | O(m * n) | O(m) | Hard | LeetCode | DP, Recursion |
191 | Maximum Product Subarray | C++ | O(n) | O(1) | Medium | LeetCode | |
392 | House Robber | C++ | O(n) | O(1) | Medium | LeetCode | |
393 | Best Time to Buy and Sell Stock IV | C++ | O(k * n) | O(k) | Hard | LeetCode, EPI | |
395 | Coins in a Line II | C++ | O(n) | O(1) | Medium | ||
396 | Coins in a Line III | C++ | O(n^2) | O(n) | Medium | ||
397 | Longest Increasing Continuous subsequence | C++ | O(n) | O(1) | Easy | ||
398 | Longest Increasing Continuous subsequence II | C++ | O(m * n) | O(m * n) | Hard | ||
403 | Continuous Subarray Sum II | C++ | O(n) | O(n) | Medium | EPI | |
430 | Scramble String | C++ | O(n^4) | O(n^3) | Hard | LeetCode | |
435 | Post Office Problem | C++ | O(n^3) | O(n^2) | Hard | PKU 1160 | |
436 | Maximal Square | C++ | O(m * n) | O(n) | Medium | LeetCode |
##Greedy
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
41 | Maximum Subarray | C++ | O(n) | O(1) | Easy | LeetCode | |
42 | Maximum Subarray II | C++ | O(n) | O(n) | Medium | ||
44 | Minimum Subarray | C++ | O(n) | O(1) | Easy | ||
45 | Maximum Subarray Difference | C++ | O(n) | O(n) | Medium | ||
116 | Jump Game | C++ | O(n) | O(1) | Medium | LeetCode | |
117 | Jump Game II | C++ | O(n) | O(1) | Medium | LeetCode | |
182 | Delete Digits | C++ | O(n) | O(n) | Medium | ||
187 | Gas Station | C++ | O(n) | O(1) | Easy | LeetCode | |
192 | Wildcard Matching | C++ | O(m + n) | O(1) | Hard | LeetCode | Greedy, DP, Recursion |
402 | Continuous Subarray Sum | C++ | O(n) | O(1) | Medium | EPI | |
412 | Candy | C++ | O(n) | O(n) | Hard | LeetCode | Greedy |
##OO Design
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
204 | Singleton | C++ | O(1) | O(1) | Easy | ||
208 | Assignment Operator Overloading (C++ Only) | C++ | O(n) | O(1) | Medium |