LeetCode Patterns: All 22 Coding Interview Patterns
There are thousands of LeetCode problems and a much smaller number of ways to solve them. A pattern is the reusable half: the data structure, the loop shape and the invariant that make a family of problems collapse into one. Learn the pattern and you stop solving problems one at a time — which is the only strategy that scales, because no amount of memorising covers the specific problem you get asked.
- Problems covered
- 2,565
- Easy
- 558
- Medium
- 1,407
- Hard
- 600
Every pattern, one page each
Each hub below is a full page: what the pattern is, when it applies, a Python template, the time and space complexity with the reason behind it, and every problem in this library the pattern covers, grouped by difficulty.
They are numbered in the order to learn them: the hash map and the two array scans built on it first, then the stack, sorting and search, the linked structures and the graph walks, and the specialist techniques last. Counts are computed from the dataset, so they are what each page actually lists.
- Hash Map709 problems
- Two Pointers201 problems
- Sliding Window116 problems
- Prefix Sum157 problems
- Stack194 problems
- Monotonic Stack225 problems
- Sorting401 problems
- Binary Search254 problems
- Linked List75 problems
- Tree Traversal225 problems
- Depth-First Search366 problems
- Breadth-First Search233 problems
- Matrix and Grid216 problems
- Heap / Priority Queue163 problems
- Greedy346 problems
- Backtracking105 problems
- Dynamic Programming481 problems
- Math and Number Theory485 problems
- Union-Find83 problems
- Topological Sort32 problems
- Trie49 problems
- Bit Manipulation194 problems
Keep exploring
Looking for a specific problem? Every pattern hub links straight to it — or start from the full problem list.