Created
March 19, 2019 19:48
-
-
Save kkchu791/93839107107681024f5d7c8899db10d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var minCostClimbingStairs = function(cost) { | |
for (let i = 2; i < cost.length; i++) { | |
cost[i] += Math.min(cost[i-1], cost[i-2]); | |
} | |
return Math.min(cost[cost.length-1], cost[cost.length-2]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment