Largest rectangle: each bar's widest rectangle
A bar's tallest possible rectangle keeps its own height and stretches left and right until a shorter bar stops it. Step through the bars; the biggest area wins.