122. 买卖股票的最佳时机 II

class Solution {
public int maxProfit(int[] prices) {
		 int maxPro = 0, tmp = 0;
	        for (int i = 1; i < prices.length; ++i) {
	            tmp = prices[i] - prices[i-1];
	            if (tmp > 0)
	                maxPro += tmp;
	        }
	        return maxPro;
	    }
}
原文地址:https://www.cnblogs.com/cznczai/p/11298264.html