https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
把所有的大于零的价格差累加起来。
class Solution {
public:
int maxProfit(vector<int>& prices) {
int n = prices.size();
if(n<2) return 0;
int i, max = 0;
//把所有大于零的价格差累加起来
for(i=1;i<n;i++){
if(prices[i]-prices[i-1]>0)
max+=prices[i]-prices[i-1];
}
return max;
}
};