DSA patterns
Interview problems repeat a small set of ideas. Learn the 76 patterns below and most new problems turn into "this is a sliding window" or "this is a BFS on a grid". Each pattern lists its practice problems, easiest first.
Arrays & Hashing
Moore's Voting Algorithm 2
Kadane's Algorithm 3
Double Reversal Trick 2
Two Pointer 2
Right to Left Traversal 2
In-place Transformations 2
Merge Sort Like Approach 2
Dutch National Flag 1
Prefix Sum Strategy 3
Sliding Window · Fixed 3
Sliding Window · Variable 2
Sliding Window · Hash Map 2
Stack
Monotonic Stack
Linked List
Dummy Node Pattern 7
Slow Fast Pointers 3
Front Back Pointer 1
Front Middle Back Pointer 4
Binary Search
Basics 2
Bisect 6
Unique 1-D Binary Search 3
Rotated Array 5
2D Binary Search + Step Search 3
Search on Answer Range 4
Binary Search on Answer Space 2
Recursion & Backtracking
Basic Recursion 5
2D Matrix 1
Pick / Not-Pick 7
Permutations 3
2D Matrix Backtracking 1
Trees & BST
Recursion 10
- Binary Tree Inorder Traversal (Recursive)
- Binary Tree Preorder Traversal (Recursive)
- Binary Tree Postorder Traversal (Recursive)
- Binary Tree Inorder Traversal (Iterative)
- Binary Tree Preorder Traversal (Iterative)
- Binary Tree Postorder Traversal (Iterative)
- Maximum Depth of Binary Tree
- Same Tree
- Symmetric Tree
- Invert Binary Tree