public int maxProfit2(int[] prices) { // only get profit >= 0
		int maxp = 0;
		int diff = 0;
		for (int i = 0; i < prices.length - 1; i++) {
			if (diff >= 0)
				diff += prices[i + 1] - prices[i];
			else
				diff = Math.max(0, prices[i + 1] - prices[i]);
			maxp = Math.max(diff, maxp);
		}
		return maxp;
	}