Largest Area Histogram
hard
1. You are given a number n, representing the size of array a. 2. You are given n numbers, representing the height of bars in a bar chart. 3. You are required to find and print the area of largest rectangle in the histogram. e.g. for the array [6 2 5 4 5 1 6] -> 12
Constraints
0 <= n < 20 0 <= a[i] <= 10
Format
Input
Input is managed for you
Output
A number representing area of largest rectangle in histogram
Example
Sample Input
7
6
2
5
4
5
1
6
Sample Output
12
Question Video