Given an integer array cost where cost[i] is the cost of step i, return the minimum cost to reach the top of the floor. You may climb one or two steps at a time. This is a standard choice-DP problem with a min-cost recurrence.
cost = cost of each step
minimum total cost to reach the top
Example 1:
Input:
cost = [10,15,20]
Output:
15
Explanation:
Take step 1 and then jump to the top.
Example 2:
Input:
cost = [1,100,1,1,1,100,1,1,100,1]
Output:
6
Explanation:
The cheapest path avoids expensive steps.