Skip to content

Commit

Permalink
Time: 44 ms (99.78%), Space: 16.5 MB (41.37%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
hovanhoa committed Oct 17, 2023
1 parent 481be7a commit ef2ccdd
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
cost.append(0)

for i in range(2, len(cost)):
cost[i] += min(cost[i-1], cost[i-2])

return cost[-1]

0 comments on commit ef2ccdd

Please sign in to comment.