Study patterns in small clusters
Choose one pattern and solve a small sequence that varies the same core idea. For sliding windows, move from a fixed-size maximum to a variable-size constraint, then to frequency maps. The goal is to see what remains constant while the problem statement changes.
Mixing ten unrelated topics in one session trains context switching more than recognition.
- Learn the basic template
- Solve two straightforward applications
- Solve one problem where the pattern is disguised
- Summarize the signal that revealed it
Use a productive struggle limit
Spend enough time to form and test hypotheses, but do not spend hours repeating the same dead end. A useful limit is based on progress rather than a rigid timer: continue while you are discovering constraints, rejecting approaches, or refining an invariant.
When progress stops, read a hint before reading code. If you need the full solution, extract only the key observation, close it, and rebuild the implementation yourself.
Write a post-solution note
After solving, record a few lines instead of copying the implementation. State the signal, the naive approach, the optimization, the invariant, and one mistake you made. These notes become a compact pattern library written in your own reasoning.
- Signal: what wording or constraint suggested the pattern?
- Invariant: what stays true during the algorithm?
- Complexity: why is each element processed only that many times?
- Failure mode: what tempting approach breaks, and why?
Rebuild on a spaced schedule
Revisit the problem after a short gap, then again after a longer one. Start from a blank editor and explain the reasoning aloud before typing. If you remember exact lines but cannot justify them, you have remembered syntax rather than learned the solution.
On later reviews, change the task: implement in another style, derive the complexity, create a counterexample for the brute-force shortcut, or solve a related problem without looking at the original.
Measure independence, not volume
A count of solved problems is useful only when it represents ideas you can recover. Track whether you solved independently, needed a hint, or needed the full explanation. Watch those problems move toward independence over repeated attempts.
Fifty deeply understood problems across major patterns can build more interview skill than hundreds copied from editorials. The target is not recognition of a page; it is reconstruction of the idea.