The 15 LeetCode Problems That Force You to Combine Multiple Patterns

- Single-pattern recognition and multi-pattern synthesis are different skills. The synthesis half is what interviews actually test.
- Minimum Window Substring (LC 76): the hash map defines validity, the sliding window finds the tightest range around it.
- Word Search II (LC 212) shows structural interdependence. The Trie prunes DFS, and DFS traverses what the Trie cannot.
- BFS state encoding (LC 1293) is the most commonly missed: add remaining eliminations to visited state or you prune valid paths.
- DP plus binary search (LC 1235) is the clearest case where a second pattern improves efficiency, not just correctness.
- The drill method: solve naively, ask what makes it slow, then identify the second pattern that eliminates that bottleneck.
- Problems 9 and 14 require a modeling step before any standard pattern applies. Skip it and you reach the right technique at the wrong layer.
Most interview prep works like this: you study sliding window, you study DFS, you practice them separately, build pattern recognition, and feel pretty good about yourself. Then you hit a problem that needs both at once and your brain quietly opens a new tab. It never comes back.
Single-pattern problems test recognition. Multi-pattern problems test synthesis. That is a different skill, and it is the one that separates candidates who get offers from candidates who solve 300 problems and still blank out in interviews.
The 15 problems below are the ones that actually train this. Not the easiest path to your next Medium badge, but the most useful path to actually passing a hard interview.
| # | Problem | LeetCode | Patterns Combined | Difficulty |
|---|---|---|---|---|
| 1 | Minimum Window Substring | 76 | Sliding Window + Hash Map | Medium |
| 2 | Sliding Window Maximum | 239 | Sliding Window + Monotonic Deque | Hard |
| 3 | Word Search II | 212 | DFS/Backtracking + Trie | Hard |
| 4 | Find Median from Data Stream | 295 | Max-Heap + Min-Heap | Hard |
| 5 | Trapping Rain Water | 42 | Two Pointers + Prefix Reasoning | Medium |
| 6 | Maximum Profit in Job Scheduling | 1235 | DP + Binary Search | Hard |
| 7 | Merge k Sorted Lists | 23 | Min-Heap + Linked List | Hard |
| 8 | Word Ladder | 127 | BFS + Implicit Graph | Hard |
| 9 | Alien Dictionary | 269 | Graph Construction + Topological Sort | Hard |
| 10 | Longest Increasing Path in Matrix | 329 | DFS + Memoization | Hard |
| 11 | LFU Cache | 460 | Hash Map + Doubly Linked List | Hard |
| 12 | Serialize and Deserialize Binary Tree | 297 | BFS/DFS + Encoding Design | Hard |
| 13 | Regular Expression Matching | 10 | DP + Recursive Structure | Hard |
| 14 | Bus Routes | 815 | BFS + Hypergraph Modeling | Hard |
| 15 | Shortest Path with Obstacles Elimination | 1293 | BFS + State Encoding | Hard |
Where One Pattern Stops Being Enough
A sliding window problem: you need a window. You slide it. You feel smart. Done.
A problem like Minimum Window Substring needs a window AND a frequency map tracking how many required characters the window satisfies. Remove either piece and the solution breaks. The window alone cannot tell you when you have a valid state. Remove the hash map and you have a window that stares blankly into the void, with no way to know if it's satisfied anything. The patterns do not just coexist; they depend on each other. That interdependence is what makes these problems genuinely hard, not just unfamiliar.

You, pattern-matching the problem to "sliding window" while the required hash map quietly waits
1. Minimum Window Substring (LC 76)
Patterns: Sliding Window + Hash Map
You need the shortest substring of S containing all characters of T. The hash map tracks required character counts; the sliding window finds the smallest valid range. The critical insight is that "valid window" is defined by the hash map state, not by the window boundaries alone. A counter tracking how many distinct required characters are currently satisfied lets you check validity in O(1) per step. The window expands until valid, then contracts while valid. Two moving parts, neither optional.
2. Sliding Window Maximum (LC 239)
Patterns: Sliding Window + Monotonic Deque
Find the maximum of every k-length window in an array. Naive approach is O(nk). The monotonic deque keeps candidates in decreasing order, evicting elements that fall outside the current window or that are smaller than an incoming element. The front of the deque is always the window maximum, giving O(n) overall. The deque's eviction logic requires knowing the current window boundary, so the two patterns are structurally coupled. You cannot implement one without the other.
3. Word Search II (LC 212)
Patterns: DFS/Backtracking + Trie
Given a board and a list of words, find all present words. DFS explores paths; the Trie tells you whether the current path prefix could lead to any word. Without the Trie, you run a full DFS for every word separately, which is way too slow. Without DFS, you cannot traverse the grid. The Trie also enables pruning: if the current prefix matches no Trie branch, stop immediately. One pattern prunes the other. This is the cleanest example of structural interdependence in the list.
4. Find Median from Data Stream (LC 295)
Patterns: Max-Heap + Min-Heap
Two heaps, one for each half of the data stream. The max-heap stores the lower half; the min-heap stores the upper half. The median is either the top of one heap or the average of both tops. After every insertion, you rebalance so the size difference stays at most 1. Neither a single sorted array nor a single heap gives you O(log n) insertion and O(1) median retrieval at the same time. The combination is the solution. Neither half works alone.
5. Trapping Rain Water (LC 42)
Patterns: Two Pointers + Prefix/Suffix Max Reasoning
Water at index i is bounded by min(leftMax, rightMax) minus height[i]. The two-pointer approach computes this without precomputing all prefix and suffix maxima. If leftMax is smaller than rightMax, the water level at the left pointer is determined entirely by leftMax, even without knowing the exact right maximum. That asymmetry justifies the pointer movement. Without the reasoning about prefix maxima, you cannot prove the pointer movement is correct. Knowing two-pointer technique alone is not enough here.
6. Maximum Profit in Job Scheduling (LC 1235)
Patterns: DP + Binary Search
Jobs have start times, end times, and profits. You want maximum profit from non-overlapping jobs. dp[i] is the max profit considering the first i jobs sorted by end time. For each job, you either skip or take it. Taking requires finding the latest job that ends before this one starts. Binary search does that in O(log n). Without binary search, the DP transition is O(n) per state, making the whole thing O(n²). With it, O(n log n). One of the cleanest examples of DP needing a second pattern just to make its own transitions efficient.
7. Merge k Sorted Lists (LC 23)
Patterns: Min-Heap + Linked List Traversal
Push the head of each list onto a min-heap. Extract the smallest, add it to output, push its next node. The heap handles ordering across k lists; linked list pointer manipulation handles the actual merging. Naively sorting all nodes is O(nk log nk). The heap approach is O(nk log k) because the heap size stays bounded at k throughout. You need to understand both heap operations and careful next pointer management to implement this without bugs. Get the pointers wrong and the heap wins nothing.
8. Word Ladder (LC 127)
Patterns: BFS + Implicit Graph
Find the shortest transformation sequence from a start word to a target, changing one letter at a time. No explicit graph is given. You construct it implicitly: each word is a node, each valid one-letter change is an edge. BFS on this implicit graph finds the shortest transformation sequence. If you do not first recognize the graph structure, BFS never occurs to you. The hard part is not the traversal. It is the modeling step that unlocks everything else.
9. Alien Dictionary (LC 269)
Patterns: Graph Construction + Topological Sort
Given a sorted list of words in an alien alphabet, infer the character ordering. You build a directed graph by comparing adjacent words character by character. The first position where two adjacent words differ gives an ordering constraint: this character precedes that character. Topological sort on that directed graph produces the alien alphabet. A cycle means no valid ordering exists. Graph construction and topological sort are fully separate skills; you need both in sequence. Missing either leaves you nowhere.
10. Longest Increasing Path in a Matrix (LC 329)
Patterns: DFS + Memoization
Find the longest strictly increasing path from any cell in a grid. DFS explores all paths from each cell. Because you can only move to strictly larger values, the traversal graph is a DAG. Memoization is valid: the result from any given cell never changes regardless of how you arrived there. Without recognizing the DAG property, you would incorrectly fear cycles and hesitate to cache. With it, you reduce exponential DFS to O(mn). The observation that enables memoization is its own independent insight.
11. LFU Cache (LC 460)
Patterns: Hash Map + Doubly Linked List
Implement a least-frequently-used cache with O(1) get and put. Three components: a key-to-value map, a key-to-frequency map, and a frequency-to-ordered-keys map using a doubly linked list. Three data structures. One interview-ender. The linked list maintains insertion order within each frequency bucket, giving O(1) eviction of the LRU key among the least-frequent ones. Without it, eviction requires a linear scan. The minFreq variable tracks which bucket to evict from and is a common source of off-by-one bugs.
The LFU cache walkthrough covers the O(1) invariants and the minFreq logic in detail if you want to go deeper before coding this.
12. Serialize and Deserialize Binary Tree (LC 297)
Patterns: BFS/DFS + Encoding Design
Convert a binary tree to a string and reconstruct it exactly. Level-order serialization with explicit null markers works because each node's position in the BFS queue tells you whose child it is. Pre-order with nulls also works. The traversal algorithm alone does not solve the problem. You also need the encoding to be unambiguous and reversible. Many candidates pick a traversal and then realize they cannot reconstruct uniquely, because they skipped the encoding design step entirely and assumed the traversal was enough.
13. Regular Expression Matching (LC 10)
Patterns: DP + Recursive Structure Understanding
Match strings against patterns with . and *. The recursive structure has overlapping subproblems, so DP. dp[i][j] is whether pattern[:j] matches string[:i]. The tricky transition is *: it either matches zero characters (dp[i][j-2]) or extends a match (dp[i-1][j] when the preceding pattern char matches string[i-1]). Without working through the recursion first, the table transitions are impossible to derive. You cannot skip the recursion step here. The DP is just a memoized version of it.
14. Bus Routes (LC 815)
Patterns: BFS + Hypergraph Modeling
Find the minimum number of buses to reach the destination stop. The key modeling shift is treating bus routes as nodes rather than individual stops. Two routes are connected if they share a stop. BFS over routes finds the minimum number of route changes. Treating individual stops as graph nodes instead leads to a structure that solves the wrong problem entirely. Congratulations, you implemented BFS correctly on a graph that doesn't answer the question.
15. Shortest Path with Obstacles Elimination (LC 1293)
Patterns: BFS + State Encoding
Find the shortest path from top-left to bottom-right with permission to eliminate up to k obstacles. Standard BFS tracks (row, col). Here the state must be (row, col, remaining_eliminations), because two paths reaching the same cell with different k values remaining are not equivalent. They are, in a sense, two different versions of you at the same location: one flush with eliminations, one out of them. Marking a cell visited without tracking remaining k prunes valid paths incorrectly. Once you encode k into the state, standard BFS handles the rest.
How to Practice Combining Patterns

Hunting the second pattern when you only prepared for one
Grinding these 15 one by one is not the point. The skill is pattern decomposition: given a new problem, can you identify which two patterns are colliding and figure out how they connect?
One method that works: solve a problem naively first, then ask what makes the naive solution slow, then ask which data structure or algorithm eliminates that bottleneck. The answer is almost always a second pattern. The naive O(n²) DP becomes O(n log n) once you binary search the transitions. The brute-force word search becomes feasible once you prune with a Trie. The cost of naivety points directly at the fix.
The dynamic programming framework breaks this down for DP problems specifically, and the sliding window guide shows how the window interacts with auxiliary structures for that whole family.
If you want to practice narrating your pattern identification out loud under real interview pressure, SpaceComplexity runs voice-based mock interviews where the AI asks follow-up questions about your approach. That forces you to articulate not just which patterns you chose but why they connect, which is exactly the thing that is invisible in silent LeetCode grinding.
What These 15 Actually Test
- Problems 3, 6, and 14 are the clearest cases where applying one pattern without the other produces an incorrect or intractable solution.
- Problems 9 and 12 require a modeling step before any standard pattern applies. Candidates who skip modeling reach the right technique at the wrong layer of abstraction.
- State encoding (problem 15) and the DAG observation (problem 10) are the most commonly missed insights among experienced candidates.
- Practice by asking what makes your naive solution slow, then which second pattern fixes it. The answer is almost always in the list above.