Given `heights`, the bar heights of a histogram (each bar 1 unit wide), implement `largestRectangle(heights)` returning the area of the largest rectangle that fits entirely within the bars.
+ 2 hidden tests run on Submit.
A monotonic increasing stack of indices lets each bar be the limiting height of a rectangle exactly when a shorter bar forces it off the stack. The width spans from the element now on top (exclusive) to the current index (exclusive). Appending a trailing 0 flushes the stack. O(n).
Run your code to see results.