FlashcardNot attempted
Pattern recognition
Recall it before you reveal
Which technique do these signals point to: "sorted array", "contiguous subarray", "next greater", "all combinations", "shortest path in an unweighted grid", "top k"?
Space to reveal
Show answer & explanation
- sorted array → binary search or two pointers
- contiguous subarray / window → sliding window, or prefix sums + hash map (when there are negatives)
- next greater / previous smaller → monotonic stack
- all combinations / permutations → backtracking
- shortest path, unweighted → BFS (weighted → Dijkstra with a heap)
- top k / k-th largest → heap of size k
- counting / "seen before" → hash map or set
- "number of ways" / min-max over choices → dynamic programming