简体中文 | English
LeetCode Solutions: A Record of My Problem Solving Journey.
This repository will be divided into four parts for now:
-
The first part is the solutions to some classic problems on LeetCode, including the idea thinkings, key points and code implementations.
-
The second part is the summary of data structures and algorithms.
-
The third part is Anki flashcards that record the LeetCode problems in a certain way so as to make it easier to remember.
-
The fourth part is daily problems which held at group chat. we solve just one problem all together, so that we can get more feedback, moreover the problems can be drafted to add to the problem solving module.
-
The fifth part is future plans on content that would be introduced into the above parts.
Only when having mastered the basic data structures and algorithms can you solve complex problems easily.
- For the parts that were added recently, there will be a 🆕 behind.
- For the parts that were updated recently, there will be a 🖊 behind.
- Here will be the place to update Anki Flashcards in the future as well.
- 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.
(Picture credited by LeetCode-cn.)
The algorithms mainly includes:
- Basic skills: Divide-and-Conquer; Binary; Greedy
- Sorting algorithms: Quicksort; Merge Sort; Counting Sort
- Searching algorithms: Backtracking; Recursion; Depth-First-Search (DFS); Breath-First-Search (BFS); Binary Search Tree; etc.
- Graph theory: Shortest Path Problem; Minimal Spanning Tree
- Dynamic Programming: Knapsack Problem; Longest Common Subsequence (LCS) Problem
The data structures mainly includes:
- Array and linked list: Singly/Doubly-Linked List
- Stack and queue
- Hash table
- Heap: Min-Max Heap
- Tree and Graph: Lowest Common Ancestor (LCA); Disjoint-Set
- String: Prefix Tree (Trie); Suffix Tree
-
Top 100 Liked Questions (77 / 100)
-
Top Interview Questions (96 / 145)
Here only lists some representative problems but not all.
- 0020.Valid Parentheses
- 0026.remove-duplicates-from-sorted-array
- 0088.merge-sorted-array
- 0104.maximum-depth-of-binary-tree
- 0121.best-time-to-buy-and-sell-stock
- 0122.best-time-to-buy-and-sell-stock-ii
- 0125.valid-palindrome 🆕
- 0129.sum-root-to-leaf-numbers 🆕
- 0136.single-number
- 0155.min-stack 🆕
- 0167.two-sum-ii-input-array-is-sorted
- 0172.factorial-trailing-zeroes
- 0169.majority-element
- 0190.reverse-bits
- 0191.number-of-1-bits
- 0198.house-robber
- 0203.remove-linked-list-elements
- 0206.reverse-linked-list
- 0219.contains-duplicate-ii
- 0226.invert-binary-tree
- 0232.implement-queue-using-stacks 🆕
- 0263.ugly-number
- 0283.move-zeroes
- 0342.power-of-four
- 0349.intersection-of-two-arrays
- 0437.path-sum-iii 🆕
- 0371.sum-of-two-integers
- 0575.distribute-candies
- 0002. Add Two Numbers
- 0003. Longest Substring Without Repeating Characters
- 0005.longest-palindromic-substring 🆕
- 0011.container-with-most-water
- 0015.3-sum
- 0019. Remove Nth Node From End of List
- 0024. Swap Nodes In Pairs
- 0029.divide-two-integers 🆕
- 0031.next-permutation 🆕
- 0033.search-in-rotated-sorted-array 🆕
- 0039.combination-sum
- 0040.combination-sum-ii
- 0046.permutations
- 0047.permutations-ii
- 0048.rotate-image 🆕
- 0049.group-anagrams 🆕
- 0055.jump-game
- 0056.merge-intervals
- 0062.unique-paths
- 0073.set-matrix-zeroes
- 0075.sort-colors
- 0078.subsets
- 0086.partition-list
- 0090.subsets-ii
- 0091.decode-ways
- 0092.reverse-linked-list-ii
- 0094.binary-tree-inorder-traversal
- 0098.validate-binary-search-tree 🆕
- 0102.binary-tree-level-order-traversal
- 0103.binary-tree-zigzag-level-order-traversal
- 0113.path-sum-ii 🆕
- 0131.palindrome-partitioning
- 0139.word-break
- 0144.binary-tree-preorder-traversal
- 0150.evaluate-reverse-polish-notation
- 0152.maximum-product-subarray
- 0199.binary-tree-right-side-view
- 0201.bitwise-and-of-numbers-range
- 0208.implement-trie-prefix-tree
- 0209.minimum-size-subarray-sum
- 0230.kth-smallest-element-in-a-bst
- 0236.lowest-common-ancestor-of-a-binary-tree🆕
- 0238.product-of-array-except-self
- 0240.search-a-2-d-matrix-ii
- 0279.perfect-squares
- 0309.best-time-to-buy-and-sell-stock-with-cooldown 🆕
- 0322.coin-change
- 0328.odd-even-linked-list
- 0334.increasing-triplet-subsequence
- 0365.water-and-jug-problem
- 0378.kth-smallest-element-in-a-sorted-matrix 🆕
- 0416.partition-equal-subset-sum
- 0445.add-two-numbers-ii
- 0454.4-sum-ii
- 0494.target-sum
- 0516.longest-palindromic-subsequence
- 0518.coin-change-2
- 0609.find-duplicate-file-in-system
- 0875.koko-eating-bananas
- 0877.stone-game
- 0887.super-egg-drop
- 0900.rle-iterator
- 1031.maximum-sum-of-two-non-overlapping-subarrays 🆕
- 0023.merge-k-sorted-lists
- 0032.longest-valid-parentheses 🆕
- 0042.trapping-rain-water
- 0124.binary-tree-maximum-path-sum 🆕
- 0128.longest-consecutive-sequence 🆕
- 0145.binary-tree-postorder-traversal
- 0146.lru-cache
- 0239.sliding-window-maximum
- 0295.find-median-from-data-stream 🆕
- 0301.remove-invalid-parentheses
- Data Structure (Drafts)
- Basic AlgorithmDrafts
- Binary Tree Traversal
- Dynamic Programming
- Huffman Encode and Run Length Encode
- Bloom Filter
- String Problems
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.
All flashcards are put in anki-card.
Please check here for more about the usage of Anki.
Latest updated flashcards (only lists the front page):
- What is the key point of the binary search algorithm? Related problems?
- How to simplify the operations using the features of stacks? Related problems?
- The thinkings and related problems of double-pointers problems?
- The thinkings and related problems of sliding window problems?
- The thinkings and related problems of backtracking?
- The thinkings and related problems of number theory?
- The thinkings and related problems of bit operations?
WIP: the translation of the flashcards are on the way.
problems added:#2 #3 #11
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.
(Add this bot and reply "leetcode" to join the group.)
- If you have any ideas, Issues or chat in groups.
- If you want to commit to the repository, Pull Request is welcome.
- If you want to edit images resources in this project, here lists the files that can be edited on draw.io.
A big Thank you to every contributor of this project.