public int largestRectangleArea(int[] height) {
		// Start typing your Java solution below
		// DO NOT write main() function
		int area = 0, i = 0;
		Stack<Integer> stack = new Stack<Integer>();
		
		while(i <= height.length){
			if(stack.isEmpty() || (i < height.length && height[i] >= height[stack.peek()])){
				stack.push(i++);
			}else{
				int top = stack.pop();
				area = Math.max(area, height[top] * (stack.isEmpty() ? i : i - stack.peek() -1));
			}
		}
		
		return area;

	}