Practice Problems — 21 Flagship Deep Dives (one per core pattern)
The 21 core patterns each get their canonical problem walked through brute force → intermediate → optimized. Every approach has its own interactive Execution Trace so you can see how each algorithm actually runs on the same example input.
Why walk the ladder instead of jumping to the optimized solution?
That's what interviews measure. The optimized solution is 20% of the grade; the walk from brute → optimized is 60%. Being able to articulate why the brute force is too slow and what specific insight unlocks the next approach is the senior signal that gets you leveled up.
How each page is structured
text
1. PROBLEM — statement, examples, constraints
2. APPROACH 1 — Brute Force
├─ Intuition │ Java code │ Execution Trace │ Complexity
3. APPROACH 2 — Intermediate improvement
├─ Insight from brute
4. APPROACH 3 — Optimized
├─ Insight from intermediate
5. COMPLEXITY SUMMARY — one comparison table
6. WHEN TO USE WHICH — interviewer-signal decision guide
7. RELATED PROBLEMS — variations that reuse the same ladderThe 21 pages
Part A — Windows & Pointers
- 1. Sliding Window — Longest Substring Without Repeating Characters
- 2. Two Pointers — Container With Most Water
- 3. Fast/Slow Pointers — Linked List Cycle II
- 4. Prefix Sum — Subarray Sum Equals K
- 5. Hashing — Two Sum
- 6. Monotonic Stack — Daily Temperatures
Part B — Search & Order
- 7. Binary Search — Search in Rotated Sorted Array
- 8. Binary Search on Answer — Koko Eating Bananas
- 9. Top-K / Heap — Top K Frequent Elements
- 10. K-way Merge — Merge K Sorted Lists
- 11. Merge Intervals — Merge Intervals
- 12. Sweep Line — Meeting Rooms II
Part C — Graphs & Sets
Part D — Greedy & Recursion
Part E — Dynamic Programming
Part F — Specialized
The pattern chapters vs these pages
| You want to… | Use… |
|---|---|
| Learn the pattern first time | Pattern chapters (Part II) |
| Practice a specific problem | These pages |
| See multiple approaches to one problem | These pages |
| See a pattern applied across many problems | Pattern chapters |
| Revise before interview | Pattern chapters + cheat sheets |
Both cross-link. Every problem page links to its pattern chapter; every pattern chapter links to its canonical problem.