Problem Description

For each testcase you get n bar heights. Compute largest rectangle area in histogram.

Input Format

First integer t. For each: n then n heights.

Output Format

t lines max areas.

Sample Test Case

Input:
1 7 2 1 5 6 2 3 1
Output:
10

Constraints

Sum of n over all testcases

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next