Solutions for leetcode problems in various programming languages.
| # | Problem | Solution | Time | Space | Difficulty |
|---|---|---|---|---|---|
| 1 | Two Sum | Python | O(N) | O(1) | Easy |
| 17 | Letter Combinations of a Phone Number | Python | O(N*4^N) | O(N) | Medium |
| 20 | Valid Parentheses | Python | O(N) | O(N) | Easy |
| 22 | Generate Parentheses | Python | O(N*4^N) | O(N) | Medium |
| 21 | Merge Two Sorted Lists | Python | O(n+m) | O(1) | Easy |
| 23 | Merge k Sorted Lists | Python | O(NlogK) | O(N) | Hard |
| 31 | Merge k Sorted Lists | Python | O(N) | O(!) | Medium |
| 39 | Combination Sum | Python | O(2^t) | O(N) | Medium |
| 40 | Combination Sum II | Python | O(2^t) | O(N) | Medium |
| 46 | Permutations | Python | O(N*2^N) | O(!) | Medium |
| 47 | Permutations II | Python | O(N*2^N) | O(N) | Medium |
| 50 | Pow(x, n) | Python | O(N) | O(!) | Medium |
| 56 | Merge Intervals | Python | O(log N) | O(1) | Medium |
| 71 | Simplify Path | Python | O(N) | O(N) | Medium |
| 75 | Sort Colors | Python | O(N) | O(1) | Medium |
| 77 | Subsets | Python | O(N * 2^n) | O(N) | Medium |
| 78 | Combinations | Python | O(k*N^k) | Ok*N^k() | Medium |
| 79 | Word Search | Python | O(N+M*3^L) | O(L) | Medium |
| 88 | Merge Sorted Array | Python | O(N+M) | O(1) | Easy |
| 90 | Subsets II | Python | O(N*2^N) | O(NlogN) | Medium |
| 94 | Binary Tree Inorder Traversal | Python | O(N) | O(N) | Easy |
| 96 | Unique Binary Search Trees | Python | O(N^2) | O(N) | Medium |
| 98 | Validate Binary Search Tree | Python | O(N) | O(N) | Medium |
| 102 | Binary Tree Level Order Traversal | Python | O(N) | O(N) | Easy |
| 103 | Binary Tree Zigzag Level Order Traversal | Python | O(N) | O(N) | Medium |
| 107 | Binary Tree Level Order Traversal II | Python | O(N) | O(N) | Medium |
| 109 | Convert Sorted List to Binary Search Tree | Python | O(N) | O(N) | Medium |
| 112 | Path Sum | Python | O(N) | O(N) | Easy |
| 113 | Convert Sorted List to Binary Search Tree | Python | O(N) | O(N) | Medium |
| 124 | Binary Tree Max Path Sum | Python | O(N) | O(N) | Medium |
| 125 | Valid Palindrome | Python | O(N) | O(1) | Easy |
| 127 | Word Ladder | Python | O(M^2*N) | O(M^2*N) | Hard |
| 131 | Palindrome Partitioning | Python | O(N*2^N) | O(N) | Medium |
| 138 | Copy List With Random Pointer | Python | O(N) | O(1) | Easy |
| 144 | Binary Tree Preorder Traversal | Python | O(N) | O(N) | Easy |
| 145 | Binary Tree Postorder Traversal | Python | O(N) | O(N) | Easy |
| 146 | LRU Cache | Python | O(1) | O(capacity) | Medium |
| 156 | Binary Tree Upside Down | Python | O(log N) | O(H) | Medium |
| 162 | Find Peak Element | Python | O(log N) | O(1) | Medium |
| 173 | Binary Search Tree Iterator | Python | O() | O() | Medium |
| 199 | Binary Tree Right Side View | Python | O() | O() | Medium |
| 200 | Number Of Islands | Python | O(M*N) | O(M*N) | Medium |
| 206 | Reverse Linked List | Python | O(N) | O(1) | Easy |
| 207 | Course Schedule | Python | O(V+E) | O(V+E) | Medium |
| 215 | Kth Largest Element In An Array | Python | O(N) | O(1) | Medium |
| 227 | Basic Calculator II | Python | O(N) | O(n) | Medium |
| 235 | Lowest Common Ancestor of a Binary Search Tree | Python | O(N) | O(1) | Easy |
| 236 | Lowest Common Ancestor of a Binary Tree | Python | O(N) | O(N) | Medium |
| 242 | Valid Anagram | Python | O(N) | O(1) | Easy |
| 249 | Group Shifted Strings | Python | O(NK) | O(NK) | Medium |
| 252 | Meeting Rooms | Python | O(NlogN) | O(1) | Easy |
| 253 | Meeting Rooms II | Python | O(NlogN) | O(N) | Medium |
| 257 | Binary Tree Paths | Python | O(N) | O(N) | Easy |
| 261 | Graph Valid Tree | Python | O(V+E) | O(V+E) | Medium |
| 314 | Binary Tree Vertical Order Traversal | Python | O(N) | O(N) | Medium |
| 323 | Number of Connected Components In An Undirected Graph | Python | O() | O() | Medium |
| 339 | Nested List Weight Sum | Python | O(N) | O(N) | Medium |
| 344 | Reverse String | Python | O(N) | O(1) | Easy |
| 347 | Top K Frequent Elements | Python | O(N) | O(N) | Medium |
| 359 | Logger Rate Limiter | Python | O(1) | O(M) | Easy |
| 408 | Valid Word Abbreviation | Python | O(N) | O(1) | Easy |
| 415 | Add Strings | Python | O(max(N1,N2)) | O(max(N1,N2)+1) | Easy |
| 426 | Add Strings | Python | O(V+E) | O(V+E) | Medium |
| 429 | N-ary Tree Level Order Traversal | Python | O(N) | O(N) | Medium |
| 494 | Target Sum | Python | O(N*t) | O(t) | Medium |
| 498 | Diagonal Traverse | Python | O(M*N) | O(1) | Medium |
| 509 | Fibonacci Number | Python | O(N) | O(1) | Easy |
| 512 | Sort An Array | Python | O(NlogN) | O(N) | Medium |
| 523 | Continuous Subarray Sum | Python | O(N) | O(k) | Medium |
| 528 | Random Pick With Weight | Python | O(N) | O(N) | Medium |
| 543 | Diameter of Binary Tree | Python | O(N) | O(N) | Easy |
| 560 | Subarray Sum Equals K | Python | O(N) | O(N) | Medium |
| 617 | Merge Two Binary Trees | Python | O(N+M) | O(N+M) | Easy |
| 636 | Exclusive Time of Functions | Python | O(N) | O(N) | Medium |
| 670 | Maximum Swap | Python | O(N) | O(N) | Medium |
| 680 | Valid Palindrome II | Python | O(N) | O(1) | Easy |
| 695 | Insert Into a Binary Search Tree | Python | O(H) | O(1) | Medium |
| 701 | Insert Into a Binary Search Tree | Python | O(H) | O(1) | Medium |
| 704 | Binary Search | Python | O(log N) | O(1) | Easy |
| 721 | Accounts Merge | Python | O(NKlogNK) | O(NK) | Medium |
| 733 | Flood Fill | Python | O(M*N) | O(M*N) | Easy |
| 766 | Toeplitz | Python | O(M*N) | O(1) | Easy |
| 784 | Letter Case Permutation | Python | O(N*2^N) | O(N*2^N) | Medium |
| 791 | Toeplitz | Python | O(N) | O(1) | Medium |
| 921 | Minimum Add to Make Parentheses Valid | Python | O(N) | O(1) | Medium |
| 938 | Range Sum of BST | Python | O(N) | O(N) | Easy |
| 953 | Verifying an Alient Dictionary | Python | O(N+M) | O(1) | Easy |
| 965 | Max Area Of Island | Python | O(M*N) | O(M*N) | Medium |
| 973 | K Closest Points to Origin | Python | O(N) | O(D) | Medium |
| 977 | Squares of a Sorted Array | Python | O(N) | O(N) | Easy |
| 1008 | Consturct A Binary Search Tree From Its Preorder Traversal | Python | O(N) | O(N) | Medium |
| 1011 | Capacity To Ship Packages Within D Days | Python | O(NLogN) | O(1) | Medium |
| 1047 | Remove All Adjacent Duplicates in String | Python | O(N) | O(N) | Easy |
| 1213 | Intersection of Three Sorted Arrays | Python | O(N) | O(1) | Easy |
| 1249 | Minimum Remove to Make Valid Parentheses | Python | O(N) | O(1) | Medium |
| 1382 | Balance a Binary Search Tree | Python | O(N) | O(N) | Medium |
| 1570 | Dot Product of Two Sparse Vectors | Python | O(N) | O(1) | Medium |
| 1650 | Lowest Common Ancestor of a Binary Tree III | Python | O(h) | O(1) | Medium |
| 1762 | Buildings With an Ocean View | Python | O(N) | O(1) | Medium |
| 1891 | Cutting Ribbons | Python | O(N) | O(N) | Medium |