DSA FAANG — Topic Roadmap
12 topics across 5 phases — each problem includes brute force → optimal approach with dry runs and code in JavaScript, Python, Java & C++. Click any topic to jump straight in.
Phase 1 — Arrays & Two Pointers
The most-asked topic in every FAANG interview. Master basic array operations, the two-pointer technique, prefix sums, and hashing patterns first — they appear inside almost every other topic.
Array
Basics, rotation, prefix sums, Kadane's algorithm, Dutch flag, matrix problemsTwo Pointer
Opposite-end search, slow/fast pointers, 3Sum, 4Sum, trapping rain waterSliding Window
Fixed-size windows, grow-shrink windows, counting & exact-K patternsPhase 2 — Sorting & Searching
Sorting unlocks O(n log n) solutions. Binary search is the go-to technique for any problem on sorted data or a monotonic answer space.
Sorting
Bubble, selection, insertion, merge sort, quick sort, counting sort — complexity & stabilityBinary Search
Classic search, lower/upper bound, rotated arrays, binary search on answerPhase 3 — Core Data Structures
These three data structures appear in almost every medium and hard problem. Knowing when to reach for each one is the key interview skill.
Stack & Queue
Parenthesis validity, monotonic stack, sliding window max, LRU cacheLinked List
Reversal, cycle detection, merge, reorder, fast & slow pointersMap & Set
HashMap patterns, frequency counting, prefix-hash tricks, subarray problemsPhase 4 — Trees & Recursion
Trees are built on recursion. Understand the recursive mental model first, then tree traversal, path problems, and construction patterns follow naturally.
Recursion
Base case, trust leap, subsequences, combinations, permutations, backtrackingTrees
DFS/BFS traversals, views, LCA, path sum, diameter, construction from traversalsPhase 5 — Advanced Patterns
The hardest interview topics. DP transforms brute-force recursion into O(n) with memoization. Bit manipulation is compact, fast, and shows up in clever optimizations.
Dynamic Programming
1D DP, 2D DP, subsequences, knapsack, string DP, partition problemsBit Manipulation
AND/OR/XOR tricks, set/unset bits, counting bits, power of two checks