#coding:utf-8
#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param cost int整型一维数组 
# @return int整型
#
class Solution:
    def minCostClimbingStairs(self , cost ):
        # write code here
        if not cost or len(cost)<2:
            return 0
        cost.append(0)
        a,b = 0,0
        for i in range(2,len(cost)):
            c = min(a+cost[i-2],b+cost[i-1])
            a,b = b,c
        return c