At the ink district of Scriptoria, Hans records each ledgers in a worn leather ledger. The guild wants answers, not guesses. 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.
