Largest Rectangle in Histogram
Updated Feb 24, 2026
Problem
Return area of largest rectangle in histogram.
Constraints
1 <= heights.length <= 10^5
Examples
Example 1
Input:
{"heights": [2, 1, 5, 6, 2, 3]}
Output:
10
Function Signature
def largestRectangleArea(self, heights: list[int]) -> int
How to Submit
Implement a Solution class with a largestRectangleArea method.
Your method will be called with the input parameters and should return the answer.