LeetCode problems
Complexity | Possible Algorithms & Techniques |
---|---|
O(1) | Math / Hash Map Lookup |
O(log n) | Binary & Ternary Search / Matrix Power / Cycle Tricks / Big Simulation Steps / Values Reranking / Math |
O(n) | Greedy / Ad-hoc / DP |
O(n log n) | Linear # Calls to Binary & Ternary Search / Pre-processing & Querying / Divide and Conquer |
O(n2) | DP / Greedy |
O(n3) | DP / Greedy |
O(n4) | DP / Greedy |
O(n5) | DP / Greedy |
O(2n) | Find all subsets / Backtracking |
O(n!) | Permutation / Combination Algorithm |
# | Title | Solution | Time | Space | Difficulty | Note |
---|---|---|---|---|---|---|
1 | two-sum | C# | O() | O() | Easy | |
121 | best-time-to-buy-and-sell-stock | C# | O() | O() | Easy | |
217 | contains-duplicate | C# | O() | O() | Easy | |
238 | product-of-array-except-self | C# | O() | O() | Medium | |
53 | maximum-subarray | C# | O() | O() | Easy | |
153 | find-minimum-in-rotated-sorted-array | C# | O() | O() | Medium | |
33 | search-in-rotated-sorted-array | C# | O() | O() | Medium | |
15 | 3sum | C# | O(n2) | O(n) | Medium | |
11 | container-with-most-water | C# | O() | O() | Medium |
# | Title | Solution | Time | Space | Difficulty | Note |
---|---|---|---|---|---|---|
62 | Unique Paths | C# | O(n * m) | O(n * m) | Medium | DP |
# | Title | Solution | Time | Space | Difficulty | Note |
---|
# | Title | Solution | Time | Space | Difficulty | Note |
---|
# | Title | Solution | Time | Space | Difficulty | Note |
---|
# | Title | Solution | Time | Space | Difficulty | Note |
---|
# | Title | Solution | Time | Space | Difficulty | Note |
---|
# | Title | Solution | Time | Space | Difficulty | Note |
---|---|---|---|---|---|---|
199 | Binary Tree Right Side View | C# | O(n) | O(n) | Medium | bfs |