AdvancedRating 1800
Largest Rectangle
Bars of width 1 have the given heights. Print the area of the largest rectangle inside the histogram.
Input
n, then n heights.
Output
An area.
Sample 1
Input
6 2 1 5 6 2 3
Output
10
Sample 2
Input
2 2 4
Output
4
Output appears here