ASAPUtils Logo ASAPUtils
Week 3

Largest Rectangle in Histogram

Largest Rectangle in Histogram derived from boundaries rather than memorized, with the increasing stack invariant, earliest-start propagation, sentinel, C++ and JavaScript solutions, and a bar-by-bar visual trace.

The problem

Given non-negative histogram bar heights with width one, return the maximum rectangular area that can be formed using one or more consecutive bars.

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

Related Problems