These are intentionally tricky.
They are not impossible.
But they are designed to test whether you truly analyze:
- Constraints
- Monotonicity
- Graph vs DP confusion
- Sliding window traps
- Greedy vs DP confusion
Slow down. Diagnose.
You are given an array of integers (can be negative). Find the maximum average subarray of length at least k.
Because we are optimizing an average and the window size is 'at least k', this becomes a binary search on answer problem with prefix sum transformation. It is not simple sliding window due to varying window size and negative numbers.
Given a matrix where each row and column is sorted, find the kth smallest element.
Although a min heap works, the optimal approach is binary search on answer. The matrix's sorted structure gives a monotonic count of elements <= mid.
You are given flight tickets represented as pairs of departure and arrival airports. Reconstruct the itinerary in lexical order.
This is actually an Eulerian path problem in a directed graph. The lexical order requirement requires a priority queue. It is NOT standard topological sort.
Given an array, determine if it can be partitioned into two subsets with equal sum.
This is a classic 0/1 knapsack (subset sum) DP problem. Greedy fails because local choices do not guarantee global partition.
Given a grid with obstacles and weights, find the minimum cost path from top-left to bottom-right.
Because movement cost varies (weights), BFS is invalid. This becomes a shortest path problem with weighted edges → Dijkstra.
You are given an array. Find the shortest subarray with sum at least k. Elements may be negative.
Negative numbers break sliding window monotonicity. The correct approach uses prefix sums and a monotonic deque to maintain increasing prefix indices.
Given a string, find the minimum cuts needed to partition it into palindromes.
This is an interval DP problem. You must compute palindrome substrings and build DP on partition positions.
You are given n nodes and edges. Each edge has a probability of success. Find the path with maximum probability from start to end.
This is a weighted graph problem where we maximize probability instead of minimize distance. Use Dijkstra with a max heap.
Given an array, find the maximum sum of a subarray of size k.
Because window size is fixed (exactly k), use fixed sliding window. Kadane is for variable-length maximum subarray.
You are given a directed graph. Determine if there exists a cycle.
In a directed graph, cycle detection is done via topological sort or DFS with recursion stack. Union-Find works mainly for undirected graphs.
What This Set Tests
This level checks whether you can:
- Detect weighted vs unweighted graphs
- Distinguish fixed window vs variable window
- Identify Eulerian path vs topological sort
- Recognize subset DP
- Avoid sliding window traps
- Recognize when binary search is hidden
High-Level Pattern Confusion Signals
| If You See | Be Careful |
|---|---|
| Negative numbers | Sliding window may fail |
| Weighted graph | BFS is wrong → use Dijkstra |
| Partition into subsets | Often DP |
| Minimize maximum | Binary search on answer |
| Exact window size | Fixed sliding window |
| All tickets used once | Eulerian path |
At this stage, pattern recognition becomes:
Not reacting to keywords.
But verifying structure.
Premium Content
Unlock Pattern Recognition Quiz 3 and all premium lessons with a subscription.
From ₹199.99/year — See plans