LeetCode Patterns
Recurring algorithmic patterns for coding interviews, organized by technique. Each pattern page includes a Go template, recognition heuristics, and a curated problem set graded by difficulty.
Core Patterns
| Pattern | Key Signal | Typical Complexity |
|---|---|---|
| Sliding Window | Contiguous subarray/substring | O(n) |
| Two Pointers | Sorted array, pair finding | O(n) |
| Fast & Slow Pointers | Cycle detection, middle of list | O(n) |
| Merge Intervals | Overlapping intervals | O(n log n) |
| Cyclic Sort | Numbers in range [0, n] | O(n) |
| In-Place Reversal of Linked List | Reverse without extra space | O(n) |
| Graph BFS | Level-order, shortest path | O(V+E) |
| Graph DFS | Path finding, exhaustive search | O(V+E) |
| Two Heaps | Median finding, scheduling | O(n log n) |
| Permutations | Generate all combinations | O(2^n) |
| Modified Binary Search | Sorted/rotated array | O(log n) |
| Top-K Elements | K largest/smallest/frequent | O(n log k) |
| K-Way Merge | Merge sorted lists | O(n log k) |
| DP Patterns | Overlapping subproblems | Varies |
| Topological Sort | Ordering with dependencies | O(V+E) |
| Monotonic Stack | Next greater/smaller element | O(n) |
| Backtracking | Constraint satisfaction | Varies |
Progress Tracker
This section is updated by the LLM as you solve problems
Problems solved: 1 Patterns started: 1 / 17
Top-K Elements — 1 problem solved (LC-347 ✅)