Skip to content

Commit a25333d

Browse files
authored
Create Solution3.py
1 parent 64322de commit a25333d

File tree

1 file changed

+6
-0
lines changed
  • solution/0700-0799/0746.Min Cost Climbing Stairs

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def minCostClimbingStairs(self, cost: List[int]) -> int:
3+
f = g = 0
4+
for i in range(2, len(cost) + 1):
5+
f, g = g, min(f + cost[i - 2], g + cost[i - 1])
6+
return g

0 commit comments

Comments
 (0)