Largest Rectangle Under a Bar Chart

Asked at Zipline · Coding Questions · Difficulty: Hard

A bar chart is drawn with bars of width `1` standing side by side on a common baseline. Find the area of the largest axis-aligned rectangle that fits entirely inside the bars, resting on the baseline and spanning one or more consecutive bars.

Loading the problem…