diff --git a/Min Cost Climbing Stairs.py b/Min Cost Climbing Stairs.py new file mode 100644 index 0000000..26b272f --- /dev/null +++ b/Min Cost Climbing Stairs.py @@ -0,0 +1,14 @@ +class Solution(object): + def minCostClimbingStairs(self, cost): + """ + :type cost: List[int] + :rtype: int + """ + f0,f1 = cost[0],cost[1] + for i in range(2,len(cost)): + tmp = cost[i] + min(f0,f1) + f0 = f1 + f1 = tmp + return min(f0,f1) + +