标签:pre vector span bin tco size int tair style
class Solution { public: int minCostClimbingStairs(vector<int>& cost) { vector<int> totol(cost.size(), 0); totol[0] = cost[0], totol[1] = cost[1]; for (int i = 2; i < cost.size(); i++) { totol[i] = min(totol[i - 2] + cost[i], totol[i - 1] +cost[i]); } return min(totol[cost.size() - 1], totol[cost.size() - 2]); } };
标签:pre vector span bin tco size int tair style
原文地址:https://www.cnblogs.com/asenyang/p/9735265.html