DSA Patterns Roadmap
A structured path from foundational patterns to advanced FAANG techniques. Follow the tiers in order — each pattern builds on the last.
Foundational Patterns
Core building blocks every other pattern depends on. Start here.
Hashing (Maps & Sets)
O(1) lookups for frequency counting and duplicate detection
Two Pointers
Converge from both ends to find pairs in sorted data
Sliding Window
Maintain a dynamic window over contiguous elements
Prefix Sum
Precompute cumulative sums for O(1) range queries
Binary Search
Halve the search space each step on sorted data
Sorting + Custom Comparators
Sort to unlock greedy, two-pointer, and interval techniques
Stack
LIFO for bracket matching, undo, and DFS iteration
Recursion
Solve problems by solving smaller versions of themselves
Linked List Techniques
PremiumPointer manipulation for reversal, merge, and partitioning
Composite Patterns
Combines beginner patterns. Most FAANG medium problems live here.
Fast & Slow Pointers
PremiumDetect cycles and find midpoints with two-speed traversal
Monotonic Stack
PremiumNext greater/smaller element in O(n)
Queue / Deque
PremiumFIFO for BFS and sliding window max/min
Heap / Priority Queue
PremiumEfficiently track top-K or merge-K sorted streams
Greedy Algorithms
PremiumLocally optimal choices that lead to global optimum
Tree Traversals (DFS/BFS)
PremiumVisit every node systematically in hierarchical structures
BST Concepts
PremiumExploit sorted in-order property for O(log n) operations
Backtracking
PremiumExplore all candidates with pruning for constraint satisfaction
Graph Traversals (DFS/BFS)
PremiumExplore connected nodes for islands, paths, and components
Interval Problems
PremiumSort and sweep to merge, insert, or find overlaps
Difference Array
PremiumApply range updates in O(1) each, reconstruct with prefix sum
High-Value FAANG Patterns
Complex patterns for hard-level interviews. Tackle these last.
Dynamic Programming
PremiumCache overlapping subproblems — 1D, 2D, knapsack, LIS
Topological Sort
PremiumOrder nodes respecting dependency constraints in DAGs
Union Find (Disjoint Set)
PremiumTrack and merge connected components in near O(1)
Trie (Prefix Tree)
PremiumFast prefix-based lookups for autocomplete and word search
Divide & Conquer
PremiumSplit, solve halves independently, combine results
Bit Manipulation
PremiumXOR tricks, bitmask DP, and O(1) integer operations
Ready to go deeper?
The detailed guide covers every pattern with intuition, code examples, practice problems, and a pattern recognition framework.
Open the Complete Guide