标签:lazy 语言 nbsp pre ima mamicode style size fit
int maxProfit(int* prices, int pricesSize) { int dp[pricesSize][2]; dp[0][0] = 0, dp[0][1] = -prices[0]; for (int i = 1; i < pricesSize; ++i) { dp[i][0] = fmax(dp[i - 1][0], dp[i - 1][1] + prices[i]); dp[i][1] = fmax(dp[i - 1][1], dp[i - 1][0] - prices[i]); } return dp[pricesSize - 1][0]; }
每日LeetCode - 122. 买卖股票的最佳时机 II(C语言)
标签:lazy 语言 nbsp pre ima mamicode style size fit
原文地址:https://www.cnblogs.com/vicky2021/p/14873028.html