[LeetCode] 122. 买卖股票的最佳时机 II
时间:2020-06-18 19:04:08
收藏:0
阅读:55
靠

class Solution {
public int maxProfit(int[] prices) {
int profit=0;
for(int i=1;i<prices.length;i++){
int tmp=prices[i]-prices[i-1];
if(tmp>0) profit+=tmp;
}
return profit;
}
}

原文:https://www.cnblogs.com/doyi111/p/13159023.html
评论(0)