Structures Mix roadmap
Problems where two or three structures have to work together.
For: Know each structure alone, ready to combine them
Two Pointers
Walk a sequence from both ends, or at two speeds, to avoid nested loops.
Sliding Window
Keep a moving range valid while you slide it across the input.
Prefix Sums
Precompute running totals so any range sum costs one subtraction.
Stack
Last in, first out. Use it to match pairs and undo work.
Binary Search
Halve the search space each step, on sorted data or on an answer range.
Monotonic Stack
Keep the stack ordered to find the next greater or smaller item in one pass.
Queue and Deque
First in, first out, plus a deque for sliding maximums and level-by-level work.
- Rate Limiter Log
- Best Training Block
- Calm Sensor Stretch
- Stepping Stones Score
- Shortest Subarray with Sum at Least K
Design
Combine data structures to build a cache, a stack with extras or an iterator.
- Encode and Decode Strings
- Raffle Drum
- Text Editor Cursor
- Browser History Tabs
- LRU Cache
- Popularity Pile
- Hospital Triage
- Parcel Lockers
- Two-Ended Shelf
- Design Circular Queue
- LFU Cache
Heap / Priority Queue
Always get the smallest or largest item next without sorting everything.
- Top K Streaming Words
- Shortest Head First
- Find Median from Data Stream
- Charging Bay Queue
- Exam Revision Plan
- Print Shop Schedule
Tries
Share prefixes in a tree of characters for fast prefix and dictionary lookups.
- Autocomplete Top Word
- Maximum XOR Pair
- Word Search II
- Fewest Phrases
- Typo-Tolerant Lookup
- Prefix Popularity Score
Trees
Think recursively: solve a node from the answers for its children.
Graphs
Traverse connected structures: islands, components, shortest hops in a grid.
- Clone Graph
- Keys and Doors
- Escape the Flood
- Courier All Stops
- Safest Gallery Walk
- One-Way Districts
- Meeting Village
- Three Bucket Pours
1-D Dynamic Programming
Break a problem into overlapping subproblems and store each answer once.
Topological Sort
Order tasks by their dependencies and detect cycles.
Union-Find
Track which items are connected with near-constant-time merges and lookups.
Shortest Paths
Dijkstra and Bellman-Ford for weighted graphs.
Knapsack and Subset DP
Choose items under a budget; the pattern behind coin change and partitions.
2-D Dynamic Programming
Fill a table indexed by two variables: grids, two strings, intervals.
- Pile Merging
- Orchard Harvest Route
- Region Target Sums
- Stall Setup Crew
- Chain Snapping Effort
- Warehouse Robot Turns
Minimum Spanning Tree
Connect every node at minimum total cost with Kruskal or Prim.