Skip to content

Commit 91b52fd

Browse files
refactor 746
1 parent e1b93d6 commit 91b52fd

File tree

1 file changed

+1
-1
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+1
-1
lines changed

src/main/java/com/fishercoder/solutions/_746.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public int minCostClimbingStairs(int[] cost) {
77
dp[0] = cost[0];
88
dp[1] = cost[1];
99
for (int i = 2; i < cost.length; i++) {
10-
dp[i] = Math.min(dp[i - 1] + cost[i], dp[i - 2] + cost[i]);
10+
dp[i] = cost[i] + Math.min(dp[i - 1], dp[i - 2]);
1111
}
1212
return Math.min(dp[cost.length - 1], dp[cost.length - 2]);
1313
}

0 commit comments

Comments
 (0)