Min Cost Climbing Stairs
Step i of a staircase costs cost[i] to stand on, and after paying you may climb one or two steps. You may start on step 0 or step 1. The top is just past the last step. Return the least total you must pay to reach the top.
Example 1
cost [10,15,20]
returns 15
Start on step 1 (15), then jump to the top.
Example 2
cost [1,100,1,1,1,100,1,1,100,1]
returns 6
Total 6.
Constraints
2 <= len(cost) <= 200 <= cost[i] <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.