public static int maxProfit(int[] prices) {
		int[] p=prices;
		int low=Integer.MAX_VALUE, n=p.length;
		int[] t=new int[n];
		for (int i=0;i<n;++i) {
			low=Math.min(p[i],low);
			t[i]=Math.max(p[i]-low, i>0?t[i-1]:0);
		}
		int high=0, rel=0;
		for (int i=n-1;i>=0;--i) {
			high=Math.max(high, p[i]);
			rel=Math.max(rel, t[i]+high-p[i]);
		}
		return rel;
	}