public int largestRectangleArea2(int[] height) {
			Stack<Integer> s = new Stack<Integer>();
			int n = height.length;
			int[] area = new int[n];
			for (int i = 0; i < n; i++) {
				while (!s.isEmpty() && height[i] <= height[s.peek()]) {//search left until we find the first bar lower than current bar
					s.pop();
				}
				int j = s.isEmpty() ? -1 : s.peek();
				area[i] += i - j - 1;
				s.push(i);
			}
			
			s=new Stack<Integer>(); //clean stack
			
			for(int i=n-1;i>=0;i--){
				while(!s.isEmpty()&&height[i]<=height[s.peek()]){//search right until we find the first bar lower than current bar
					s.pop();
				}
				int j=s.isEmpty()?n:s.peek();
				area[i]+=j-i-1;
				s.push(i);
			}
			
			int max=0;
			for(int i=0;i<n;i++){
				max=Math.max(max, height[i]*(area[i]+1));
			}
			return max;

		}