Min cost climbing stairs
Easydynamic programmingarray
cost[i] is the price of standing on step i. You may start on step 0 or 1, and from any step climb 1 or 2. Return the least cost to get past the last step.
Example 1
Input: cost = [10,15,20] Output: 15
Start at 15 and climb 2.
Example 2
Input: cost = [1,100,1,1,1,100,1,1,100,1] Output: 6
Constraints
- 2 ≤ cost.length ≤ 1000
- 0 ≤ cost[i] ≤ 999
Submit checks your solution against 8 tests, including hidden ones.
/**
* @param {int[]} cost
* @return {int}
*/
function minCostClimbingStairs(cost) {
}