/**
* @param {number[]} cost
* @return {number}
*/
var minCostClimbingStairs = function(cost) {
const length = cost.length;
for (let i = 2; i < length; i++) {
cost[i] += Math.min(cost[i - 1], cost[i - 2]);
}
return Math.min(cost[length - 1], cost[length - 2]);
};
minCostClimbingStairs([10, 15, 20]); //?
Read next

How to convert your Spring Boot app to serve over HTTPs instead of HTTP?
Vijay SRJ -

AWS CDK: Lambda Versioning
Gerald Stewart -

Newbie here! Designing my own website
Preet Parmar -

Site tradeoffs: SEO vs Speed vs Ease of update
Tony Kharioki -
Discussion (0)