17 FAANG Patterns — Overview
Phase 3 -- The 17 FAANG Coding Patterns (Days 23-38)
Goal: Transform topic knowledge into pattern recognition speed. This is the bridge between "I know arrays" and "I instantly see this is a sliding window problem."
Pre-req: Complete Phases 1-2 first. Read how-to-think.md if you haven't.
Why This Phase Exists (Read First)
Phase 1 and 2 taught you topics in blocked practice — all arrays in one block, all DP in another. Blocked practice feels productive but produces shallow learning. Research on retrieval practice (Roediger & Karpicke, 2006) and interleaved practice (Rohrer & Taylor, 2007) shows that:
- Re-solving without notes beats re-reading. Your goal in Phase 3 is not to learn new content. It is to retrieve what you've already seen, under time pressure, without scaffolding. Each successful retrieval strengthens the pattern's neural trace far more than re-reading the README would.
- Mixing patterns within a session forces real recognition. When all problems in a session are sliding-window problems, your brain doesn't have to recognise the pattern — it knows. Phase 3's mixed days (37-38) are deliberately designed to remove that crutch.
- The bottleneck in real interviews is identification, not implementation. You don't fail because you can't write BFS. You fail because, given a new problem, you don't see that it's a BFS problem in the first 60 seconds.
Diagnose Your Failures
When a Phase 3 problem stumps you, the failure type tells you where to revisit:
| Failure mode | What it means | Where to go back |
|---|---|---|
| Picked the wrong pattern | You haven't built the "this shape → this pattern" lookup yet | Re-read how-to-think.md Step 3 ("Pattern Recognition") + the pattern's "Key Signal" column below |
| Right pattern, wrong implementation | Pattern recognised but the template muscle isn't there | templates.py — copy the relevant template and adapt it |
| Right answer, wrong complexity | Time/space estimate was off | Phase 0 Big-O cheat sheet + the module-specific complexity table |
| Couldn't even start | The underlying topic isn't solid yet | Go back to the Phase 1 or Phase 2 module that owns the topic |
What "Identify Pattern Before Coding" Looks Like
For Day 37-38 mixed practice, your literal sequence on each problem is:
1. Read the problem twice. DO NOT scroll to hints.
2. Write down on paper, BEFORE coding:
- Pattern guess (one of the 17 below)
- Why you think so (one signal sentence — e.g. "sorted array + pair = Two Pointers")
- Expected time / space complexity
3. Now solve. If your guess was right and your complexity matched, full credit.
If you guessed wrong, study the actual pattern signal you missed.
4. Whether you got it right or wrong, log the pair (your guess, actual) in the
accuracy log at the bottom of this file.
A single problem solved this way teaches more than three problems solved by jumping straight to code.
How Phase 3 Works
Phase 3 is NOT about learning new topics. It's about speed and recognition.
Daily Routine (Days 23-38)
1. Pick a pattern from the tracker below (work top to bottom)
2. Re-read the "When to Recognize" signals
3. Solve 2-3 NEW problems for that pattern (from LeetCode, filtered by tag)
4. Re-solve 1-2 problems from Phase 1-2 that use this pattern -- TIMED
- Easy: must finish in 10 min
- Medium: must finish in 20 min
- Hard: must finish in 30 min
5. If you can't finish timed -> add to the redo queue
6. End of day: quiz yourself -- "given this problem statement, which pattern?"
Pattern Rotation Schedule
| Days | Patterns to Drill | Source |
|---|---|---|
| 23-24 | Two Pointers, Fast & Slow, Sliding Window | Phase 2 modules 2-3 |
| 25-26 | BFS, DFS, Backtracking | Phase 2 modules 4-5 |
| 27-28 | Binary Search (classic + on answer), Prefix Sum | Phase 2 module 1, Phase 1 module 2 |
| 29-30 | Dynamic Programming (1D, 2D, knapsack) | Phase 2 module 7 |
| 31-32 | Merge Intervals, Greedy, Monotonic Stack/Queue | Phase 2 module 6, Phase 1 module 6 |
| 33-34 | Top K / Heaps, Two Heaps, K-way Merge | Phase 1 module 8 |
| 35-36 | Topological Sort, Union-Find, Cyclic Sort | Phase 1 module 9, Phase 4 preview |
| 37-38 | MIXED -- random problems, identify pattern before solving | All |
The Mixed Practice Protocol (Days 37-38)
This is the most important part. On these days:
1. Go to leetcode.com/problemset/ -> filter Medium -> Random
2. Read the problem. Do NOT look at tags.
3. BEFORE coding, write down: "I think this is [PATTERN] because [SIGNAL]"
4. Then solve. Check if your pattern guess was right.
5. Track accuracy: __/10 correct pattern identifications
Pattern Mastery Tracker
Mark [x] when you can solve 3+ problems with this pattern in under 20 min each.
| # | Pattern | Confident? | Key Signal | Template in templates.py |
|---|---|---|---|---|
| 1 | Two Pointers | [ ] | Sorted input, find pair/triplet | two_pointers_opposite() |
| 2 | Fast & Slow Pointers | [ ] | Cycle detection, middle finding | fast_slow_pointers() |
| 3 | Sliding Window | [ ] | Contiguous subarray/substring | sliding_window_variable() |
| 4 | Merge Intervals | [ ] | Overlapping intervals | merge_intervals() |
| 5 | Cyclic Sort | [ ] | Array with range [1,n] | Index placement |
| 6 | In-place LL Reversal | [ ] | Reverse part of LL | reverse_linked_list() |
| 7 | BFS (Tree/Graph) | [ ] | Level order, shortest path | bfs() |
| 8 | DFS (Tree/Graph) | [ ] | All paths, deep exploration | dfs() / dfs_grid() |
| 9 | Two Heaps | [ ] | Median, balanced partition | MedianFinder |
| 10 | Subsets / Backtracking | [ ] | Combinations, permutations | backtrack() |
| 11 | Modified Binary Search | [ ] | Sorted with twist | binary_search() |
| 12 | Top K Elements | [ ] | K largest/smallest/frequent | Heap pattern |
| 13 | K-way Merge | [ ] | K sorted sources | Min-heap of heads |
| 14 | Topological Sort | [ ] | Dependencies, ordering | topological_sort() |
| 15 | Dynamic Programming | [ ] | Overlapping subproblems | dp_1d() / dp_2d_strings() |
| 16 | Prefix Sum | [ ] | Range queries, subarray sums | prefix_sum() |
| 17 | Monotonic Stack/Queue | [ ] | Next greater/smaller, window extremes | next_greater_element() |
Each pattern has its own folder. Open the folder README for the pattern's thinking guide. Use the extra practice problems below for deliberate drilling, or pick fresh problems from LeetCode filtered by the matching topic tag.
Pattern Recognition Cheat Sheet
"Subarray / Substring" -> Sliding Window / Two Pointers
"Sorted array + target" -> Two Pointers / Binary Search
"Top/Kth largest/smallest" -> Heap
"All combinations/permutations" -> Backtracking
"Tree level by level" -> BFS
"Shortest path (unweighted)" -> BFS
"Dependencies / ordering" -> Topological Sort
"Overlapping intervals" -> Sort + Merge
"Maximum/Minimum cost/ways" -> DP
"Linked list cycle" -> Fast & Slow
"Connected components" -> DFS / BFS / Union-Find
"Range sum / subarray sum = K" -> Prefix Sum + HashMap
"Next greater/smaller element" -> Monotonic Stack
"Sliding window max/min" -> Monotonic Queue (Deque)
"Matrix traversal / rotation" -> In-place / Layer-by-layer
Extra Practice Problems (Phase 3 Additions)
These are additional problems NOT in Phase 1-2. Use them for pattern drilling.
| # | Problem | Pattern | Difficulty | Time | Status |
|---|---|---|---|---|---|
| 1 | Find K Closest Elements | Binary Search + Two Ptrs | Medium | 25 min | [ ] |
| 2 | Longest Mountain in Array | Two Pointers | Medium | 25 min | [ ] |
| 3 | Shortest Bridge | BFS + DFS | Medium | 30 min | [ ] |
| 4 | Cheapest Flights Within K Stops | BFS / Bellman-Ford | Medium | 30 min | [ ] |
| 5 | Course Schedule II | Topological Sort | Medium | 25 min | [ ] |
| 6 | House Robber III | DP on Trees | Medium | 25 min | [ ] |
| 7 | Longest Palindromic Substring | DP / Expand | Medium | 25 min | [ ] |
| 8 | Maximal Square | 2D DP | Medium | 25 min | [ ] |
| 9 | Daily Temperatures (re-do timed) | Monotonic Stack | Medium | 15 min | [ ] |
| 10 | Find Median from Data Stream (re-do timed) | Two Heaps | Hard | 20 min | [ ] |
Pattern Identification Accuracy Log (Days 37-38)
| # | Problem | My Guess | Actual Pattern | Correct? |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 | ||||
| 9 | ||||
| 10 |
Accuracy target: 8/10+ -- if below, repeat Days 37-38 before moving to Phase 4.
External Resources (Hand-Picked Supplements)
- NeetCode 150 Roadmap — the canonical pattern-organised problem set. Use as a source of "fresh problems for known patterns" during Phase 3 drills.
- LeetCode Explore Cards (free tier) — the "Array 101", "Linked List", "Binary Tree" cards give labelled pattern problems with editorial hints. Great for warming up before the un-labelled Day 37-38 drills.
- Educative — Grokking the Coding Interview (free preview) — the original "17 patterns" course; the free preview covers Sliding Window and Two Pointers in depth and is the best concise pattern teaching anywhere.
- Tech Interview Handbook — 75 LeetCode Pattern Set (Blind 75) — the original 75 list. Many of these problems appear in Phases 1-2; use the rest as a Phase 3 mixed-practice source.