|
| 1 | +#LeetCode |
| 2 | + |
| 3 | +[简体中文](./README.md) | English |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +##Introduction |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +LeetCode Solutions: A Record of My Problem Solving Journey. |
| 12 | + |
| 13 | +This repository will be divided into four parts for now: |
| 14 | + |
| 15 | +- The first part is the solutions to some classic problems on LeetCode, including the idea thinkings, key points and code implementations. |
| 16 | + |
| 17 | +- The second part is the summary of data structures and algorithms. |
| 18 | + |
| 19 | +- The third part is[Anki flashcards](https://apps.ankiweb.net) that record the LeetCode problems in a certain way so as to make it easier to remember. |
| 20 | + |
| 21 | +- The fourth part is future plans on content that would be introduced into the above parts. |
| 22 | + |
| 23 | +>Only when having mastered the basic data structures and algorithms can you solve complex problems easily. |
| 24 | +
|
| 25 | + |
| 26 | + |
| 27 | +##Usage Instructions |
| 28 | + |
| 29 | +- For the parts that were added recently, there will be a 🆕 behind. |
| 30 | +- For the parts that were updated recently, there will be a 🖊 behind. |
| 31 | +- Here will be the place to update Anki Flashcards in the future as well. |
| 32 | +- Here is a mind mapping graph showing the summary of categorizations of problems that are questioned frequently in interviews. We could analyze according to the information in the graph. |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +(Picture credited by[LeetCode-cn](https://www.zhihu.com/question/24964987/answer/586425979).) |
| 37 | + |
| 38 | +The algorithms mainly includes: |
| 39 | + |
| 40 | +- Basic skills: Divide-and-Conquer; Binary; Greedy |
| 41 | +- Sorting algorithms: Quicksort; Merge Sort; Counting Sort |
| 42 | +- Searching algorithms: Backtracking; Recursion; Depth-First-Search (DFS); Breath-First-Search (BFS); Binary Search Tree; etc. |
| 43 | +- Graph theory: Shortest Path Problem; Minimal Spanning Tree |
| 44 | +- Dynamic Programming: Knapsack Problem; Longest Common Subsequence (LCS) Problem |
| 45 | + |
| 46 | +The data structures mainly includes: |
| 47 | + |
| 48 | +- Array and linked list: Singly/Doubly-Linked List |
| 49 | +- Stack and queue |
| 50 | +- Hash table |
| 51 | +- Heap: Min-Max Heap |
| 52 | +- Tree and Graph: Lowest Common Ancestor (LCA); Disjoint-Set |
| 53 | +- String: Prefix Tree (Trie); Suffix Tree |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +##Previews |
| 58 | + |
| 59 | +[0042.trapping-rain-water](./problems/42.trapping-rain-water.md): |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +[Stack in Browser](./thinkings/basic-data-structure.md): |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +[backtrack problems](./problems/90.subsets-ii.md): |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +[0198.house-robber](./problems/198.house-robber.md): |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +[0454.4-sum-ii](./problems/454.4-sum-ii.md): |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +##Top Problems Progress |
| 82 | + |
| 83 | +-[Top 100 Linked Questions](https://leetcode.com/problemset/top-100-liked-questions/) (44 / 100) |
| 84 | + |
| 85 | +-[Top Interview Questions](https://leetcode.com/problemset/top-interview-questions/) (64 / 145) |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +##Portals |
| 90 | + |
| 91 | +###Solutions to LeetCode Classic Problems |
| 92 | + |
| 93 | +>Here only lists some representative problems but not all. |
| 94 | +
|
| 95 | +####Easy |
| 96 | + |
| 97 | +-[0020.Valid Parentheses](./problems/20.validParentheses.md) |
| 98 | +-[0026.remove-duplicates-from-sorted-array](./problems/26.remove-duplicates-from-sorted-array.md) |
| 99 | +-[0088.merge-sorted-array](./problems/88.merge-sorted-array.md) |
| 100 | +-[0121.best-time-to-buy-and-sell-stock](./problems/121.best-time-to-buy-and-sell-stock.md) 🆕 |
| 101 | +-[0122.best-time-to-buy-and-sell-stock-ii](./problems/122.best-time-to-buy-and-sell-stock-ii.md) 🆕 |
| 102 | +-[0136.single-number](./problems/136.single-number.md) |
| 103 | +-[0167.two-sum-ii-input-array-is-sorted](./problems/167.two-sum-ii-input-array-is-sorted.md) |
| 104 | +-[0169.majority-element](./problems/169.majority-element.md) |
| 105 | +-[0190.reverse-bits](./problems/190.reverse-bits.md) |
| 106 | +-[0191.number-of-1-bits](./problems/191.number-of-1-bits.md) |
| 107 | +-[0198.house-robber](./problems/198.house-robber.md) 🆕 |
| 108 | +-[0203.remove-linked-list-elements](./problems/203.remove-linked-list-elements.md) |
| 109 | +-[0206.reverse-linked-list](./problems/206.reverse-linked-list.md) |
| 110 | +-[0219.contains-duplicate-ii](./problems/219.contains-duplicate-ii.md) |
| 111 | +-[0226.invert-binary-tree](./problems/226.invert-binary-tree.md) |
| 112 | +-[0283.move-zeroes](./problems/283.move-zeroes.md) |
| 113 | +-[0349.intersection-of-two-arrays](./problems/349.intersection-of-two-arrays.md) |
| 114 | + |
| 115 | + |
| 116 | +####Medium |
| 117 | + |
| 118 | +-[0002. Add Two Numbers](./problems/2.addTwoNumbers.md) |
| 119 | +-[0003. Longest Substring Without Repeating Characters](./problems/3.longestSubstringWithoutRepeatingCharacters.md) |
| 120 | +-[0011.container-with-most-water](./problems/11.container-with-most-water.md) |
| 121 | +-[0015.3-sum](./problems/15.3-sum.md) 🆕 |
| 122 | +-[0019. Remove Nth Node From End of List](./problems/19.removeNthNodeFromEndofList.md) |
| 123 | +-[0024. Swap Nodes In Pairs](./problems/24.swapNodesInPairs.md) |
| 124 | +-[0039.combination-sum](./problems/39.combination-sum.md) |
| 125 | +-[0040.combination-sum-ii](./problems/40.combination-sum-ii.md) |
| 126 | +-[0046.permutations](./problems/46.permutations.md) |
| 127 | +-[0047.permutations-ii](./problems/47.permutations-ii.md) |
| 128 | +-[0055.jump-game](./problems/55.jump-game.md) 🆕 |
| 129 | +-[0062.unique-paths](./problems/62.unique-paths.md)🆕 |
| 130 | +-[0075.sort-colors](./problems/75.sort-colors.md) |
| 131 | +-[0078.subsets](./problems/78.subsets.md) 🆕 |
| 132 | +-[0086.partition-list](./problems/86.partition-list.md) |
| 133 | +-[0090.subsets-ii](./problems/90.subsets-ii.md) |
| 134 | +-[0091.decode-ways](./problems/91.decode-ways.md) 🆕 |
| 135 | +-[0092.reverse-linked-list-ii](./problems/92.reverse-linked-list-ii.md) |
| 136 | +-[0094.binary-tree-inorder-traversal](./problems/94.binary-tree-inorder-traversal.md) |
| 137 | +-[0102.binary-tree-level-order-traversal](./problems/102.binary-tree-level-order-traversal.md) |
| 138 | +-[0103.binary-tree-zigzag-level-order-traversal](./problems/103.binary-tree-zigzag-level-order-traversal.md) |
| 139 | +-[0139.word-break](./problems/139.word-breakmd) |
| 140 | +-[0144.binary-tree-preorder-traversal](./problems/144.binary-tree-preorder-traversal.md) |
| 141 | +-[0150.evaluate-reverse-polish-notation](./problems/150.evaluate-reverse-polish-notation.md) 🖊 |
| 142 | +-[0152.maximum-product-subarray](./problems/152.maximum-product-subarray.md) 🆕 |
| 143 | +-[0199.binary-tree-right-side-view](./problems/199.binary-tree-right-side-view.md) |
| 144 | +-[0201.bitwise-and-of-numbers-range](./problems/201.bitwise-and-of-numbers-range.md) |
| 145 | +-[0208.implement-trie-prefix-tree](./problems/208.implement-trie-prefix-tree.md) 🆕 |
| 146 | +-[0209.minimum-size-subarray-sum](./problems/209.minimum-size-subarray-sum.md) 🖊 |
| 147 | +-[0236.lowest-common-ancestor-of-a-binary-tree](./problems/236.lowest-common-ancestor-of-a-binary-tree.md)🆕 |
| 148 | +-[0238.product-of-array-except-self](./problems/238.product-of-array-except-self.md) 🆕 |
| 149 | +-[0240.search-a-2-d-matrix-ii](./problems/240.search-a-2-d-matrix-ii.md) |
| 150 | +-[0279.perfect-squares](./problems/279.perfect-squares.md) |
| 151 | +-[0309.best-time-to-buy-and-sell-stock-with-cooldown](./problems/309.best-time-to-buy-and-sell-stock-with-cooldown.md) 🆕 |
| 152 | +-[0322.coin-change](./problems/322.coin-change.md) |
| 153 | +-[0334.increasing-triplet-subsequence](./problems/334.increasing-triplet-subsequence.md) |
| 154 | +-[0328.odd-even-linked-list](./problems/328.odd-even-linked-list.md) |
| 155 | +-[0416.partition-equal-subset-sum](./problems/416.partition-equal-subset-sum.md) |
| 156 | +-[0445.add-two-numbers-ii](./problems/445.add-two-numbers-ii.md) |
| 157 | +-[0454.4-sum-ii](./problems/454.4-sum-ii.md) 🆕 |
| 158 | +-[0494.target-sum](./problems/494.target-sum.md) 🆕 |
| 159 | +-[0518.coin-change-2](./problems/518.coin-change-2.md) |
| 160 | +-[0875.koko-eating-bananas](./problems/875.koko-eating-bananas.md) |
| 161 | +-[0877.stone-game](./problems/877.stone-game.md) |
| 162 | +-[0887.super-egg-drop](./problems/887.super-egg-drop.md) |
| 163 | +-[0900.rle-iterator](./problems/900.rle-iterator.md) |
| 164 | + |
| 165 | +####Hard |
| 166 | +-[0023.merge-k-sorted-lists](./problems/23.merge-k-sorted-lists.md) |
| 167 | +-[0042.trapping-rain-water](./problems/42.trapping-rain-water.md) |
| 168 | +-[0128.longest-consecutive-sequence](./problems/128.longest-consecutive-sequence.md) 🆕 |
| 169 | +-[0145.binary-tree-postorder-traversal](./problems/145.binary-tree-postorder-traversal.md) |
| 170 | +-[0146.lru-cache](./problems/146.lru-cache.md) |
| 171 | +-[0239.sliding-window-maximum](./problems/239.sliding-window-maximum.md) |
| 172 | +-[0295.find-median-from-data-stream](./problems/295.find-median-from-data-stream.md) 🆕 |
| 173 | +-[0301.remove-invalid-parentheses](./problems/301.remove-invalid-parentheses.md) |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | +###Summary of Data Structures and Algorithms |
| 178 | + |
| 179 | +- 🖊[Data Structure](./thinkings/basic-data-structure.md) (Drafts) |
| 180 | +- 🖊[Binary Tree Traversal](./thinkings/binary-tree-traversal.md) |
| 181 | +-[Dynamic Programming](./thinkings/dynamic-programming.md) |
| 182 | +-[Huffman Encode and Run Length Encode](./thinkings/run-length-encode-and-huffman-encode.md) |
| 183 | +-[Bloom Filter](./thinkings/bloom-filter.md) |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | +###Anki Flashcards |
| 188 | + |
| 189 | +Anki falshcards would be mainly two parts: the mappings from key points to problems; the mappings from problems to idea thinks, key points and code implementations. |
| 190 | + |
| 191 | +All flashcards are put in[anki-card](./assets/anki/leetcode.apkg). |
| 192 | + |
| 193 | +>Please check[here](https://apps.ankiweb.net/) for more about the usage of Anki. |
| 194 | +
|
| 195 | +Latest updated flashcards (only lists the front page): |
| 196 | + |
| 197 | +- What is the key point of the binary search algorithm? Related problems? |
| 198 | +- How to simplify the operations using the features of stacks? Related problems? |
| 199 | +- The thinkings and related problems of double-pointers problems? |
| 200 | +- The thinkings and related problems of sliding window problems? |
| 201 | +- The thinkings and related problems of backtracking? |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | +###Future Plans |
| 206 | + |
| 207 | +-[0494.target-sum](./todo/494.target-sum.js) |
| 208 | + |
| 209 | +-[0609.find-duplicate-file-in-system](./todo/609.find-duplicate-file-in-system.js) |
| 210 | + |
| 211 | +-[0010.regular-expression-matching](./todo/10.regular-expression-matching.js) |
| 212 | + |
| 213 | +-[0309.best-time-to-buy-and-sell-stock-with-cooldown](./todo/309.best-time-to-buy-and-sell-stock-with-cooldown.js) |
| 214 | + |
| 215 | +-[0365.water-and-jug-problem](./todo/365.water-and-jug-problem.js) |
| 216 | + |
| 217 | +-[Complete Anki Flashcards](./assets/anki/) |
| 218 | + |
| 219 | +-[Collection of String Problem](./todo/str/) |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | +##Community Chat Groups |
| 224 | + |
| 225 | +We're still on the early stage, so feedback from community is very welcome. For sake of reducing the costs of communication, I created some chat groups. |
| 226 | + |
| 227 | +###Telegram |
| 228 | + |
| 229 | +[http://t.me/leetcode_intl](http://t.me/leetcode_intl) |
| 230 | + |
| 231 | +###QQ (For China Region) |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | +###WeChat (For China Region) |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | +(Add this bot and reply "leetcode" to join the group.) |
| 240 | + |
| 241 | + |
| 242 | + |
| 243 | +##Contribution |
| 244 | + |
| 245 | +- If you have any ideas,[Issues](https://github.com/azl397985856/leetcode/issues) or chat in groups. |
| 246 | +- If you want to commit to the repository, Pull Request is welcome. |
| 247 | +- If you want to edit images resources in this project,[here](./assets/drawio/) lists the files that can be edited on[draw.io](https://www.draw.io/). |