This site uses one functional cookie to keep feature rollouts consistent for you. Nothing is set until you choose. See the privacy notice.
Grinding problems in a random order is slow, and grinding one topic until it feels easy is misleading. What works is learning a pattern, recalling it rather than rereading it, mixing it in with the others, and coming back to it just as it starts to fade.
The same eight steps every time, until they're automatic and the only thing left to think about is the problem.
Restate it and work one example by hand.
Input, output, and a small case on paper. Half of the wrong answers I've written came from solving a slightly different problem than the one asked.
Read the constraints before the clever part.
The largest n tells you the complexity budget. n ≤ 20 invites backtracking; n up to 10^5 rules out anything quadratic.
Name the signal, then the pattern.
Which words gave it away? Say the pattern out loud before writing a line. If nothing jumps out, run down the roadmap asking each pattern's question.
Say the brute force and its complexity.
It's the fallback if the better idea doesn't come, and the baseline the better idea has to beat. Interviewers want to hear it.
Improve it with the pattern's question.
What am I recomputing? What would sorting buy me? What do I need to remember from what I've already seen?
Write it, then trace it.
Run your example through the code by hand, then the edge cases: empty, one element, all the same, duplicates, negatives, the largest input.
Timebox the struggle to 25 minutes.
Stuck past that, open the tell. Still stuck, read a solution until you understand it, close it, and write it yourself. Rate it Again so it comes back tomorrow.
Rate it and write one line.
“The signal was ___, the trick was ___.” That sentence is what you're actually trying to remember, more than the code.
Each day: ten drill cards first (five minutes), then clear anything due, then two new problems from this week's ladders. Saturdays are a timed mock: two mediums in 45 minutes, out loud. Sundays are for catching up or resting.
| Week | Patterns | Focus |
|---|---|---|
| 1 | Get fast at the easy ones. Most mediums are one of these plus a twist. | |
| 2 | Subarrays and substrings: window when it's contiguous and monotone, prefix sums when it isn't. | |
| 3 | Binary search on the answer is the one people miss. Practise the predicate. | |
| 4 | Decide what each recursive call returns before writing it. | |
| 5 | Write the toolkit heap from memory until it takes five minutes. | |
| 6 | Choose, explore, un-choose; then grids as graphs. | |
| 7 | Lower frequency, high payoff when they turn up. Greedy needs an argument, not a hunch. | |
| 8 | Define dp[i] in words first. Then mock interviews: two a week, timed, out loud. |
Four weeks instead? Do two weeks a week, and take only the first four or five problems of each ladder. After the eight weeks, keep the drill and the due list going. Ten minutes a day keeps it all warm.
A 45-minute coding round grades how you get to the answer as much as the answer itself. The same shape every time keeps nerves from deciding what you do next.