Problem
A list heights describes a histogram: bar i is one unit wide and heights[i] tall, and the bars stand side by side. Return the **area of the largest rectangle** that fits entirely inside the histogram.
Example 1
- Input
- heights = [2, 1, 5, 6, 2, 3]
- Output
- 10
- Why
- bars 5 and 6, height 5, width 2
Example 2
- Input
- heights = [2, 4]
- Output
- 4
Example 3
- Input
- heights = [2, 1, 2]
- Output
- 3
- Why
- height 1 across all three bars
Constraints
1 <= heights.length <= 10^50 <= heights[i] <= 10^4