Largest Rectangle In Histogram (opens in new tab)
leetcode.com Problem Statement Given an array heights[] representing the height of histogram bars, find the area of the largest rectangle that can be formed. Each bar has: Width = 1 Brute Force Intuition In an interview, you can explain it like this: Consider every bar as the smallest bar in a rectangle. Expand towards both left and right until a smaller bar is encountered, then compute the area. Although straightforward, every expansion scans multiple bars repeatedly. Complexity Time Complex...
Read the original article