Learn the data structure first, then the patterns commonly used on it.
- Two Sum
- Contains Duplicate
- 3Sum
- 3Sum Closest
- 4Sum
- Longest Substring Without Repeating Characters
- Longest Repeating Character Replacement
- Minimum Window Substring
- Maximum Subarray
- Product of Array Except Self
- Count of Range Sum
- Find Minimum in Rotated Sorted Array
- Search in Rotated Sorted Array
- Best Time to Buy and Sell Stock
- Valid Anagram
- Group Anagrams
- Valid Palindrome
- Longest Substring Without Repeating Characters
- Longest Repeating Character Replacement
- Minimum Window Substring
- Set Matrix Zeroes
- Spiral Matrix
- Rotate Image
- Word Search
- Unique Paths
- Unique Paths II
- Minimum Path Sum
- Pascal's Triangle
- Dungeon Game
- Maximal Square
- Maximal Rectangle
- Largest Rectangle in Histogram
- Maximal Rectangle
- Next Greater Element
- Previous Greater Element
- Previous Smaller Element
- Next Greater Element
- Next Smaller Element
- Path Finding
- Maze Problems
- Shortest Path Problems
- Level Order Traversal
- Word Search
- Path Enumeration
- Count of Smaller Numbers After Self
- Count of Range Sum
| Data Structure | Important Patterns |
|---|---|
| Array | Hashing, Two Pointers, Sliding Window, Prefix Sum, Binary Search, Greedy |
| String | Hashing, Two Pointers, Sliding Window |
| Matrix | Traversal, DFS, Backtracking, Dynamic Programming |
| Stack | Monotonic Stack |
| Tree | DFS, BFS |
| Graph | DFS, BFS |
| Advanced Arrays | Divide & Conquer |
- Hashing
- Two Pointers
- Sliding Window
- Prefix Sum
- Binary Search
- Greedy
- Hashing
- Two Pointers
- Sliding Window
- Matrix Traversal
- DFS / Backtracking
- Dynamic Programming
- Monotonic Stack
- Divide & Conquer
Master these patterns:
- Hashing
- Two Pointers
- Sliding Window
- Prefix Sum
- Binary Search
- DFS/BFS
- Dynamic Programming
- Monotonic Stack
These alone solve roughly 80–90% of coding interview problems.