public int maxProfitRec(int[] prices, int s, int e, int [] maxmin) {
		if (s >= e) {
            Arrays.fill(maxmin, prices[s]);
            return 0;
        }
		if (e - s == 1) {
			int diff = prices[e] - prices[s];
            maxmin[0] = Math.max(prices[s], prices[e]);
            maxmin[1] = Math.min(prices[s], prices[e]);
			return diff >= 0 ? diff : 0;
		}
		int mid = (e + s) >>> 1;
		int diff1 = maxProfitRec(prices, s, mid, maxmin);
        int max0 = maxmin[0], min0 = maxmin[1];
		int diff2 = maxProfitRec(prices, mid + 1, e, maxmin);
        int max1 = maxmin[0], min1 = maxmin[1];
		int diff = max1 - min0;
        maxmin[0] = Math.max(max0, max1);
        maxmin[1] = Math.min(min0, min1);
		return Math.max(diff, Math.max(diff1, diff2));
	}