This theory is part of Premium
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricingClimb one or two steps at a time, paying each visited step's cost, for the cheapest way up.
What this asks
Climb one or two steps at a time, paying each visited step's cost, and finish with the cheapest total.
dp[i] = cost[i] + min(dp[i - 1], dp[i - 2]), starting from the free ground below step 0.
The full write-up (worked counting examples, the trap list and the interview playbook) unlocks with a Premium plan, along with every Pro visualizer.
See pricing