题目: 题解: int largestRectangleArea(int* heights, int heightsSize) {int st[heightsSize];int p[2];p[0]=-1,p[1]=heightsSize;int size=0,result=0;st[size++]=0;for(int i=1;i<heightsSize;i++){ while(size!
题目: 题解: class Solution:def largestRectangleArea(self, heights: List[int]) -> int:n = len(heights)left, right = [0] * n, [n] * nmono_stack = list()for i in range(n):while mono_stack and heights[mon
题目: 题解: class Solution {public int largestRectangleArea(int[] heights) {int n = heights.length;int[] left = new int[n];int[] right = new int[n];Arrays.fill(right, n);Deque<Integer> mono_stack = ne
Largest Rectangle in Histogram 单调栈 class Solution {public int largestRectangleArea(int[] heights) {Stack<Integer> stack=new Stack<>();int maxArea=0,n=heights.length;for(int i=0;i<=n;i++){while(!stack