LeetCode is really a fantastic platform for practicing Algorithms + Data Structures, this repository is mainly used to recite my idea and others ideas of solving leetcode problems. I will try my best to update this repository regularly. Give me 👍 👍 👍 👍 👍.
Top | NO. | Title | Solution | Note | Difficulty | Time Complexity | Space Complexity | Tag |
---|---|---|---|---|---|---|---|---|
1 | (001) | Two Sum | Python | Note | easy | O(n) | O(n) | Array, Hash Table |
2 | (002) | Add Two Numbers | Python | Note | medium | O(m+n) | O(m+n) | linked list |
3 | (013) | Roman to Intergers | Python | Note | easy | O(n) | O(n) | string |
4 | (344) | Reverse String | Python | Note | easy | O(n) | O(1) | string |
29 | (104) | Maximum Depth of Binary Tree | Python | Note | easy | O(n) | O(n) | DFS, BFS |
30 | (053) | Maximum Subarray | Pythin | Note | easy | O(n) | O(1) | dynamical programming |
34 | (169) | Majority Elememnt | Python | Note | easy | O(n) | O(1) | array |
74 | (200) | Number of Islands | Python | Note | medium | O(n) | O(n) | DFS |
83 | (219) | Contains Duplicate II | Python | Note | easy | O(n) | O(n) | hash table |
91 | (72) | Edit Distance | Python | Note | hard | O(mn) | O(mn) | dynamical programming |
126 | (268) | Missing Number | Python | Note | easy | O(n) | O(1) | bit manipulation |
142 | (287) | Find the Duplicate Number | Python | Note | medium | O(n) | O(1) | cycle detection |
143 | (448) | Find All Numbers Disappeared in an Array | Python | Note | easy | O(n) | O(1) | array |
149 | (089) | Gray Code | Python | Note | medium | O(2^n) | O(2^n) | recursion |
162 | (695) | Max Area of Island | Python | Note | easy | O(mn) | O(mn) | dfs |
184 | (717) | 1-bit and 2-bit Characters | Python | Note | easy | O(n) | O(1) | array |
195 | (442) | Find All Duplicates in an Array | Python | Note | medium | O(n) | O(1) | array |
221 | (215) | Kth Largest Element in an Array | Python | Note | medium | O(k+(n-k)*lgk) | O(k) | heap |
224 | (102) | Binary Tree Level Order Traversal | Python | Note | medium | O(n) | O(n) | BFS |
231 | (165) | Compare Version Numbers | Python | Note | medium | O(n) | O(n) | string |
259 | (111) | Minimum Depth of Binary Tree | Python | Note | easy | O(lgn) | O(1) | BFS, DFS |
274 | (322) | Coin Change | Python | Note | medium | O(nk) | O(nk) | dynamical programming |
282 | (343) | Integer Break | Python | Note | medium | O(n^2) | O(n) | dynamical programming |
303 | (107) | Binary Tree Level Order Traversal II | Python | Note | easy | O(n) | O(n) | BFS |
305 | (199) | Binary Tree Right Side View | Python | Note | medium | O(n) | O(n) | BFS |
312 | (144) | Binary Tree Preorder Traversal | Python | Note | medium | O(n) | O(n) | DFS |
322 | (074) | Search a 2D Matrix | Python | Note | medium | O(lgmn) | O(1) | binary search |
353 | (103) | Binary Tree Zigzag Level Order Traversal | Python | Note | medium | O(n) | O(n) | BFS |
417 | (213) | House Robber II | Python | Note | medium | O(n) | O(1) | dynamical programming |
457 | (537) | Complex Number Multiplication | Python | Note | medium | O(1) | O(1) | math |
458 | (718) | Maximum Length of Repeated Subarray | Python | Note | medium | O(mn) | O(mn) | dynamical programming |
477 | (712) | Minimum ASCII Delete Sum for Two Strings | Python | Note | medium | O(mn) | O(mn) | dynamical programming |
490 | (513) | Find Bottom Left Tree Value | Python | Note | medium | O(lgn) | O(lgn) | BFS, DFS |
520 | (673) | Number of Longest Increasing Subsequence | Python | Note | medium | O(n^2) | O(n^2) | dynamical programming |
539 | (583) | Delete Operation for Two Strings | Python | Note | medium | O(mn) | O(mn) | dynamical programming |
551 | (515) | Find Largest Value in Each Tree Row | Python | Note | medium | O(n) | O(1) | BFS |
562 | (791) | Custom Sort String | Python | Note | medium | O(nlgn) | O(1) | string |
685 | (576) | Out of Boundary Paths | Python | Note | medium | O(Nmn) | O(Nmn) | dynamical programming |
696 | (829) | Consecutive Numbers Sum | Python | Note | medium | O(sqrt(N)) | O(1) | math |
725 | (835) | Image Overlap | Python | Note | medium | O(n^4) | O(n^2) | string |
753 | (831) | Masking Personal Information | Python | Note | medium | O(1) | O(1) | string |
763 | (841) | Keys and Rooms | Python | Note | medium | O(n) | O(n) | BFS, DFS |
769 | (824) | Goat Latin | Python | Note | easy | O(n) | O(n) | string |
770 | (832) | Flipping an Image | Python | Note | easy | O(n) | O(1) | array |
792 | (808) | Soup Servings | Python | Note | medium | O(mn) | O(mn) | dynamical programming |
802 | (836) | Rectangle Overlap | Python | Note | easy | O(1) | O(1) | array |
803 | (838) | Push Dominoes | Python | Note | medium | O(n) | O(n) | dynamical programming |
804 | (837) | New 21 Game | Python | Note | medium | O(n) | O(n) | dynamical programming |
805 | (840) | Magic Squares In Grid | Python | Note | easy | O(mn) | O(1) | array |
808 | (844) | Backspace String Compare | Python | Note | medium | O(n) | O(n) | stack |
811 | (848) | Shifting Letters | Python | Note | medium | O(n) | O(n) | array |
814 | (851) | Loud and Rich | Python | Note | medium | O(V+E) | O(V+E) | dp, dfs |
816 | (853) | Car Fleet | Python | Note | medium | O(nlgn) | O(n) | array |
- | (846) | Hands of Straights | Python | Note | medium | O(nw) | O(n) | array |
- | (856) | Score of Parentheses | Python | Note | medium | O(n) | O(1) | stack |
- | (858) | Mirrot Reflection | Python | Note | medium | O(logn) | O(1) | math |