Algorithms from zero
Recursion & backtracking: interview drill
You understand backtracking. Interviews test whether you can reach for it under a timer, cold, and explain the cost out loud.
Solve each problem before you reveal a hint, hit the target time, and narrate the time and space complexity as if an interviewer were listening. The hints exist for when you are genuinely stuck — they nudge you toward the pattern, never the full solution.
Five NeetCode-150 problems on the backtracking pattern this unit teaches. Set a timer, solve each cold without looking at a hint, then say the time and space complexity out loud before you move on. Reveal a hint only when you are truly stuck — the hints nudge, they never hand you the answer.
0/5 solved
backtracking
Follow-up (aloud)
There are 2^n subsets. Justify the O(n·2^n) time and explain where the extra factor of n comes from.
Follow-up (aloud)
Why does passing 'start' rather than letting the recursion pick any index prevent permutations of the same combination?
Follow-up (aloud)
There are n! permutations — narrate the time bound and contrast it with the 2^n of subsets.
Follow-up (aloud)
The count of valid strings is the nth Catalan number. You don't need the formula — but why does pruning invalid prefixes matter for the real cost?
Follow-up (aloud)
Give the worst-case time as O(m·n·4^L) and define L; explain why the visited-restore step keeps space at O(L).
Mark each problem solved once you finished it cold, inside the target time, and could state the complexity without hesitation. Come back in a few days and re-solve the ones you marked — spaced revisits are what turn a recognised pattern into a reflex.