Diagnostic Refresh
Hashing, Windows & Heaps RefreshRe-establish frequency state, contiguous-range reasoning, and bounded candidate selection.Core
Hashing, Windows & Heaps Refresh
Why am I learning this?
Re-establish frequency state, contiguous-range reasoning, and bounded candidate selection.
Prerequisites
Start here - no required prerequisite.
Learn
- Frequency state
- Window validity
- Bounded heaps
Recognize It When…
- Repeated membership or grouping
- A contiguous range changes one boundary at a time
- Only the best K candidates matter
Core Problems
3Not StartedLongest Substring Without Repeating CharactersVariable sliding windowMediumCore
The canonical exercise for expanding, detecting invalidity, and shrinking.
Not StartedTop K Frequent ElementsFrequency map + Top KMediumCore
Composes counting with candidate selection and supports multiple valid strategies.
The signal is not merely reaching a solution; compare sorting, a bounded heap, and buckets against n, k, and streaming constraints.
Alternative approaches
| Approach | Time | Space | Use when |
|---|---|---|---|
| Sort frequencies | O(n log n) | O(n) | Simplest when the full ordering is also useful. |
| Size-K heap | O(n log k) | O(n) | Strong when k is small or candidates arrive incrementally. |
| Frequency buckets | O(n) | O(n) | Best when frequencies are bounded by input size. |
Interview follow-ups
- When would you choose a heap over frequency buckets?
- How does the complexity change when K is close to n?
- Support continuous updates to the frequencies.
- What changes when k is close to the number of unique values?
Mastery Check
- Solve without pattern prompts and state the invariant before coding.
Two Pointers RefreshConfirm that pointer movement eliminates candidates by proof rather than habit.Core
Two Pointers Refresh
Why am I learning this?
Confirm that pointer movement eliminates candidates by proof rather than habit.
Prerequisites
Start here - no required prerequisite.
Learn
- Opposite-end pointers
- Read/write boundaries
- Sorted-order elimination
Recognize It When…
- A pair or range can be narrowed from its boundaries
- The input order makes one pointer movement safe
Practice
No problems in this topic match the active plan and filters. The full topic remains available when filters are reset.
Mastery Check
- Explain which candidates each pointer movement permanently eliminates.
Search & Interval RefreshRefresh boundary contracts and sort-then-scan interval reasoning.Core
Search & Interval Refresh
Why am I learning this?
Refresh boundary contracts and sort-then-scan interval reasoning.
Prerequisites
Start here - no required prerequisite.
Learn
- Binary-search boundary meaning
- Interval overlap invariants
Recognize It When…
- A sorted half can be eliminated
- Sorting reveals a stable overlap order
Core Problems
2Not StartedSearch in Rotated Sorted ArrayRotated binary searchMediumCore
Combines exact lookup with identifying the usable sorted half.
Mastery Check
- Explain every boundary movement and interval merge condition.
Tree & Graph RefreshVerify traversal contracts before weighted and stateful extensions.Core
Tree & Graph Refresh
Why am I learning this?
Verify traversal contracts before weighted and stateful extensions.
Prerequisites
Start here - no required prerequisite.
Learn
- Recursive return contracts
- Visited-state policy
- BFS versus DFS
Recognize It When…
- Hierarchical subproblems
- Implicit or explicit connectivity
Core Problems
2Not StartedValidate Binary Search TreeBST boundsMediumCore
Replaces incorrect local comparisons with a global recursive invariant.
Not StartedNumber of IslandsConnected componentsMediumCore
The central grid-as-graph exercise for component counting.
Use this refresh problem to compare traversal and connectivity models, mutation policy, and stack-depth risk.
Alternative approaches
| Approach | Time | Space | Use when |
|---|---|---|---|
| DFS | O(rows × cols) | O(rows × cols) | Compact traversal when recursion depth is safe. |
| BFS | O(rows × cols) | O(rows × cols) | Avoids recursive stack depth and exposes layers. |
| Union Find | Near O(rows × cols) | O(rows × cols) | Useful when connectivity is built incrementally. |
Interview follow-ups
- How would BFS differ from DFS here?
- What changes if mutating the input is not allowed?
Mastery Check
- Choose traversal and visited representation deliberately.
Heap, DP & Backtracking RefreshCheck that candidate selection, state transitions, and state restoration remain fluent.Core
Heap, DP & Backtracking Refresh
Why am I learning this?
Check that candidate selection, state transitions, and state restoration remain fluent.
Prerequisites
Start here - no required prerequisite.
Learn
- Bounded candidate sets
- DP state meaning
- Choose/recurse/undo
Recognize It When…
- Only the best K candidates matter
- Overlapping choice subproblems
- Enumerate constrained combinations
Core Problems
3Not StartedTop K Frequent ElementsFrequency map + Top KMediumCore
Composes counting with candidate selection and supports multiple valid strategies.
The signal is not merely reaching a solution; compare sorting, a bounded heap, and buckets against n, k, and streaming constraints.
Alternative approaches
| Approach | Time | Space | Use when |
|---|---|---|---|
| Sort frequencies | O(n log n) | O(n) | Simplest when the full ordering is also useful. |
| Size-K heap | O(n log k) | O(n) | Strong when k is small or candidates arrive incrementally. |
| Frequency buckets | O(n) | O(n) | Best when frequencies are bounded by input size. |
Interview follow-ups
- When would you choose a heap over frequency buckets?
- How does the complexity change when K is close to n?
- Support continuous updates to the frequencies.
- What changes when k is close to the number of unique values?
Not StartedHouse RobberTake / skip DPMediumCore
Builds the most reusable one-dimensional choice recurrence.
Interview follow-ups
- Can the auxiliary space become O(1)?
Mastery Check
- Compare at least two valid approaches for one diagnostic problem.
Sign in to persist problem state across this roadmap and the question library.