We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2b0f9c commit 2913d8dCopy full SHA for 2913d8d
src/main/java/com/fishercoder/solutions/_746.java
@@ -27,7 +27,7 @@ public static class Solution1 {
27
public int minCostClimbingStairs(int[] cost) {
28
int[] dp = new int[cost.length];
29
dp[0] = cost[0];
30
- dp[1] = Math.min(cost[1], cost[0] + cost[1]);
+ dp[1] = cost[1];
31
for (int i = 2; i < cost.length; i++) {
32
dp[i] = Math.min(dp[i - 1] + cost[i], dp[i - 2] + cost[i]);
33
}
0 commit comments