Hard · Arrays
Largest Rectangle in Histogram
Given an array heights of non-negative bar heights, each bar 1 unit wide, return the area of the largest rectangle that fits inside the histogram.
Examples
Example 1
[2,1,5,6,2,3]Output: max area 10
Example 2
[2,4]Output: max area 4
Rebuild it in the studio
Core interview problems are free with a full runner and lessons; Pro opens the complete library.