class Solution:
def minCostClimbingStairs(self, cost: list[int]) -> int:
a = b = 0
for c in cost:
a, b = b, min(a, b) + c
return min(a, b)
746. Min Cost Climbing Stairs - LeetCode
ยท One min read
class Solution:
def minCostClimbingStairs(self, cost: list[int]) -> int:
a = b = 0
for c in cost:
a, b = b, min(a, b) + c
return min(a, b)