How do you build a practice routine for data structures that compounds over time?
Two habits do most of the work. Space your repetitions, so a problem you struggled with comes back tomorrow, next week and next month, and a problem you solved easily comes back much later. And spend your review time only on what you got wrong, because rereading a solution you already understood teaches you nothing.
from collections import Counter
attempts = ["two sum", "two sum", "kadane", "valid parentheses", "two sum", "kadane"]
def review_queue(log):
seen = Counter(log)
return [topic for topic, count in seen.items() if count > 1]
print(review_queue(attempts))The output is the list two sum and kadane, the two topics that appeared more than once in the log and so deserve more review time.
The mechanism is the spacing effect. Memory research is consistent on this: a skill you nearly have is retained much better by a short session today and a short session in a few days than by one long session today. The review queue is the practical version of that, since it identifies exactly which topics are still fragile.
The trade-off to name is that this approach feels slower than grinding one topic for a weekend, because the work is spread thin and the repetition is not adjacent. The result is the opposite of what it feels like. A second point is to keep the problems fresh rather than repeating the same ones verbatim, since recognising a specific problem is a different skill from recognising the pattern, and the interview will give you a new problem wearing the pattern.