int maxProfit(int* prices, int pricesSize) {
int profit = 0;
int i, j;
for(i = 0; i < pricesSize - 1; i++)
for(j = i + 1; j < pricesSize; j++)
{
if(prices[i] < prices[j]){
profit += prices[j] - prices[i];
break; }
}
return profit;
}
LeetCode122买卖股票的最佳时机 II
猜你喜欢
转载自blog.csdn.net/a_learning_boy/article/details/84322679
今日推荐
周排行