← 返回 bytedance 的题目列表Largest Rectangle Area in Histogram
类型:online_judge
Given an integer array heights where heights[i] is the height of the i-th bar in a histogram (each bar has width 1), compute the largest rectangle area in the histogram.
Input:
First line: integer n.
Second line: n integers heights.
Output: one integer, the maximum rectangle area.
Constraints:
1 <= n <= 2 * 10^5
0 <= heights[i] <= 10^9
Example: Input:
6
2 1 5 6 2 3
Output:
10
Example
Input
6
2 1 5 6 2 3
Output
10