Back to DSA sheet

Largest Rectangle in Histogram

HardStack & Queue
Open on LeetCodeAmazonGoogleMeta

Given bar heights of a histogram, find the area of the largest rectangle that fits entirely within it.

Constraints
  • 1 <= n <= 10^5
  • 0 <= heights[i] <= 10^4
Sheets
Blind 75NeetCode 150NeetCode 250Striver A2Z
largest-rectangle-in-histogram.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.