Approach hintTry it first, then revealHide
The widest rectangle using a bar's full height extends to the nearest shorter bar on each side. An increasing stack reveals both boundaries at the moment a bar is popped. O(n).
The widest rectangle using a bar's full height extends to the nearest shorter bar on each side. An increasing stack reveals both boundaries at the moment a bar is popped. O(n).