84. Largest Rectangle in Histogram
84. Largest Rectangle in Histogram
Description
Given an array of integers heights representing the histogram’s bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram.
Example 1:
1 | Input: heights = [2,1,5,6,2,3] |
Example 2:
1 | Input: heights = [2,4] |
Constraints:
1 <= heights.length <= 10^50 <= heights[i] <= 10^4
Hints/Notes
- 2024/12/25
- monotonic stack
- 0x3F’s solution(checked)
Solution
Language: C++
1 | class Solution { |