链接: https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
class Solution { public: int maxProfit(vector<int> &prices) { if(prices.size()==0) return 0; int ans=0; for(int i=0;i<prices.size()-1;i++) { if(prices[i+1]>prices[i]) ans+=prices[i+1]-prices[i]; } return ans; } };
天下武功,唯快不破