All challenges

Algorithm challenge · DSA

Largest Rectangle in Histogram

Difficulty

hard

Time

~40m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#stack#monotonic-stack
Mission file // read carefullyhard

Given heights representing a histogram where each bar has width 1, return the area of the largest rectangle that fits entirely within the histogram.

Example

heights = [2,1,5,6,2,3]  =>  10

Build with

largestRectangleArea(heights: int[]) → int
PythonJavaScriptTypeScriptGoJavaC++Rust
5 tests · 2 hidden
Auto-graded on submit
Start challenge

Sign in to save your progress.