Min Cost Climbing Stairs
Easy
LC #746
1d dpNot attempted yet
cost[i] is the price of stepping off step i.
After paying you climb 1 or 2 steps. You may start on step
0 or step 1 for free. The top is just past the last step
(index len(cost)).
Return the minimum total cost to reach the top.
Example 1
Input: cost = [10, 15, 20]
Output: 15
start on step 1, pay 15, climb 2
Example 2
Input: cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]
Output: 6
Example 3
Input: cost = [5, 10]
Output: 5
Constraints
- 2 ≤ len(cost) ≤ 1000
- 0 ≤ cost[i] ≤ 999