• + 5 comments

    I also agree. It seems this problem is more like an algorithm problem instead of the data structure problem using the stack. I used the dynamic programming to find the maximum possible largest rectangle. For each height, I found the width to the right and left where each rectangle can extend at most. And then, I simply multiplied each height and width and updated the largest rectangle from the first to the last rectangle.