https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
同一天先卖后买相当于不卖不买。
public class Solution {
public int maxProfit(int[] prices) {
int res = 0;
if (prices == null || prices.length == 0) {
return res;
}
for (int i = 1; i < prices.length; i++) {
if (prices[i] > prices[i - 1]) {
res += prices[i] - prices[i - 1];
}
}
return res;
}
}