Visualize
Recursion tree
Calls, base cases, memoization, made visible. Change the inputs and step through it.
Recursion tree: what it shows
A recursive function calls itself on a smaller problem until it reaches a base case. Every call waits for the calls below it, then combines their answers on the way back up. Turn memoization on to see which repeated calls disappear.