loading…
You climb n stairs taking 1 or 2 steps at a time. Write climb(n) returning the number of distinct ways to reach the top.
climb(2) -> 2 # 1+1, 2
climb(3) -> 3 # 1+1+1, 1+2, 2+1
Stuck on the idea itself? The recursion & dp lesson walks through the pattern from scratch.