Loading page…
A recursion that asks the same smaller question again and again can be fixed in two ways: save each answer the first time (memoisation, top down), or fill a table from the base cases in the right order (tabulation, bottom up). Climbing stairs shows the repeated calls, the three parts of every solution (state, transition and base case), the order of filling, and saving space. Coin change shows where biggest coin first fails and a table does not, and routes on a grid and common letters are the next classic problems.
You work on a fitness app with a stair challenge.