public int largestRectangleArea2(int[] height) {
		// Start typing your Java solution below
		// DO NOT write main() function
		if (height == null || height.length == 0)
			return 0;

		int max = 0, tmp;
		Stack<Integer> stack = new Stack<Integer>();
		for (int i = 0; i < height.length; i++) {
			if (!stack.isEmpty() && stack.peek() > height[i]) {
				int count = 1;
				while (!stack.isEmpty()) {
					if (stack.peek() > height[i]) {
						tmp = count * stack.pop();
						max = Math.max(max, tmp);
						count++;
					} else
						break;
				}

				for (int j = 1; j < count; j++)
					stack.push(height[i]);
			}

			stack.push(height[i]);
		}

		int count = 1;
		while (!stack.isEmpty()) {
			max = Math.max(max, count * stack.pop());
			count++;
		}

		return max;
	}