public int maxProfit(int[] prices) {
		int n = prices.length;
		if (n == 0)
			return 0;
		int lowest = prices[0];
		int curMax;
		int maxMax = 0;
		for (int i = 0; i < n; i++) {
			if (prices[i] < lowest) {
				lowest = prices[i];
			} else {
				curMax = prices[i] - lowest;
				if (curMax > maxMax)
					maxMax = curMax;
			}
		}
		return maxMax;
	}