@@ -0,0 +1,901 @@
+package problems;%0A%0Aimport java.util.Stack;%0A%0Apublic class LargestRectangleInHistogram %7B%0A    public int largestRectangleArea(int%5B%5D height) %7B%0A        int max = 0, i = 0;%0A        Stack%3CInteger%3E S = new Stack%3CInteger%3E();%0A        while (i %3C= height.length) %7B%0A            if (i == height.length && S.empty())%0A                i++;%0A            else if (i %3C height.length && (S.empty() %7C%7C height%5BS.peek()%5D %3C height%5Bi%5D)) %7B%0A                S.push(i);%0A                i++;%0A            %7D else %7B%0A                int t = S.pop();%0A                max = Math.max(max, height%5Bt%5D * (S.empty() ? i : i - S.peek() - 1));%0A            %7D%0A        %7D%0A        return max;%0A    %7D%0A    %0A    public static void main (String%5B%5D args) %7B%0A        LargestRectangleInHistogram lr = new LargestRectangleInHistogram();%0A        %0A        int%5B%5D height = %7B2,1,5,6,2,3%7D;%0A        %0A        System.out.println(lr.largestRectangleArea(height));%0A    %7D%0A%7D%0A

Add Largest Rectangle in Historgram