/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 * 
 * @param cost int整型一维数组 
 * @param costLen int cost数组长度
 * @return int整型
 */

#include <math.h>
int min ( int a , int b ) {
    return ( a < b ) ? a : b ;
}

int minCostClimbingStairs(int* cost, int costLen ) {
    int dp[100005];
    memset ( dp , 0 , sizeof (dp));
    // dp[i] 表示 爬到 第 i 层所花费的最小费用
    int n = costLen;
    for (int i = 2; i <= n; i ++ ) {
        dp[i] = min ( dp[i-1] + cost[i-1] , dp[i-2] + cost[i-2]);
    }

    return dp[n];
}