The hardest part of an unfamiliar interview problem is rarely the pattern's implementation — once you've identified it as a sliding window, you can probably write it correctly. The actual skill is recognizing which pattern a new problem is asking for, underneath whatever specific story it's dressed up in. This is the mapping worth having memorized cold:
| Problem phrasing / constraint | Pattern | Chapter |
|---|---|---|
| "Find a pair that sums to X" (sorted input) | Two pointers, opposite ends | Two Pointers & Sliding Window |
| "Longest/shortest substring or subarray satisfying..." | Sliding window, variable size | Two Pointers & Sliding Window |
| "Subarray of exactly size k" | Sliding window, fixed size | Two Pointers & Sliding Window |
| "Have you seen this value before" / "find duplicates" | Hashing | Hashing Patterns |
| "Group items by some computed key" (anagrams, etc.) | Hashing, frequency map | Hashing Patterns |
| "Valid parentheses" / matching opens and closes | Stack | Stacks & Monotonic Stack |
| "Next greater/smaller element" / "daily temperatures" | Monotonic stack | Stacks & Monotonic Stack |
| "Generate all subsets/permutations/combinations" | Backtracking | Recursion & Backtracking |
| "Every path from root to leaf" | Tree DFS | Trees |
| "Process level by level" / "minimum depth" | BFS, level order | Trees, Graphs: BFS & DFS |
| Sorted array — find, or find the insertion point of, a value | Binary search | Binary Search |
| "Minimize the maximum" / "smallest value such that..." over a range | Binary search on the answer | Binary Search |
| "Shortest path" in an unweighted graph | BFS | Graphs: BFS & DFS |
| "How many separate groups/islands/components" | BFS/DFS, connected components | Graphs: BFS & DFS |
| "Order these given dependencies" / "can this be scheduled at all" | Topological sort | Graphs: Topological Sort & Union-Find |
| "Are these two things connected," with edges arriving incrementally | Union-find | Graphs: Topological Sort & Union-Find |
| "Count the ways to..." / "min or max cost to reach..." with overlapping smaller cases | Dynamic programming | Dynamic Programming Part 1 and 2 |
| Comparing two strings/sequences for similarity | 2D DP, LCS family | Dynamic Programming Part 2 |
| Items with weight/value under a capacity limit | Knapsack DP | Dynamic Programming Part 2 |
| "Maximize/minimize," and the locally best choice provably never backfires | Greedy | Greedy Algorithms |
| "Top K" / "K largest or smallest" / "the Kth largest" | Heap | Heaps & Priority Queues |
| Merge K sorted lists, or a running median over a stream | Heap | Heaps & Priority Queues |
| Values are integers in a small, known range, and O(n log n) isn't fast enough | Counting/radix sort | Sorting & Searching Beyond the Basics |
None of this table replaces actually writing the code. Reading a pattern and being able to reproduce it cold, under interview time pressure, on a problem phrased in an unfamiliar way, are genuinely different skills — and the gap between them closes only with repetition. Every pattern above has real, runnable problems tagged for it in the Code Lab; work through a handful from each pattern until the recognition step in this table starts happening automatically, before you ever read the problem's full description.