Given an array of integers, heights, that represents the heights of bars in a histogram, find the area of the largest rectangle in the histogram, where the rectangle has a constant width of 1 unit for each bar.
Constraints
1≤heights.length≤105
0≤heights[i]≤ ...
⋮
Tap here to switch tabs
Problem
Ask
Submissions
Solution
Solution: Largest Rectangle in Histogram
Statement▼
Given an array of integers, heights, that represents the heights of bars in a histogram, find the area of the largest rectangle in the histogram, where the rectangle has a constant width of 1 unit for each bar.