In the salt flats of Palemere, Vigo the scribe keeps careful count of the registers. Document the rare sighting, every figure matters. Task: Bars of heights h[i] stand side by side with width 1. Print the largest rectangle area that fits inside the histogram. Input format: First line: n. Second line: n heights. Output format: Print the maximum area (fits 64-bit). Constraints: 1 <= n <= 4000; 0 <= h[i] <= 10^9.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 4000; 0 <= h[i] <= 10^9.
