int minCostClimbingStairs(int* cost, int costSize){ int i,f1=0,f2=0; for (i=costSize-1; i>=0; i--) { int f0 = cost[i] + fmin(f1,f2); f2 = f1; f1 = f0; } return fmin(f1,f2); }