84. Largest Rectangle in Histogram
class Solution { public int largestRectangleArea(int[] heights) { Stack<Integer> st = new Stack<>(); int res = 0; for(int i=0; i<heights.length; i++){ while(!st.isEmpty() && heights[st.peek()] >= heights[i]){ ...
Aug 7, 20251 min read2