- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Riverbank before a very long crossing
Trick to keep in mind+3 XP
Deep input? Loop it. A recursion pays one stack frame per level, a loop pays none.
Every nested call sits on the call stack until it returns, and CPython stops you at roughly a thousand frames by default. A bottom-up loop fills a list in place, so its stack never grows with the input. That is why tabulation is the safe form for very long inputs, while memoization is simply the easier one to write.
Read it once, then a question tests whether the trick stuck.