Skip to content

Commit 92e579f

Browse files
authored
Create 0746-min-cost-climbing-stairs.dart
1 parent f9807f4 commit 92e579f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
int minCostClimbingStairs(List<int> cost) {
3+
for (int i = cost.length - 3; i >= 0; i--) {
4+
cost[i] += min(cost[i + 1], cost[i + 2]);
5+
}
6+
7+
return min(cost[0], cost[1]);
8+
}
9+
}

0 commit comments

Comments
 (0)