Class Solution
java.lang.Object
g0001_0100.s0084_largest_rectangle_in_histogram.Solution
84 - Largest Rectangle in Histogram.<p>Hard</p>
<p>Given an array of integers <code>heights</code> representing the histogram’s bar height where the width of each bar is <code>1</code>, return <em>the area of the largest rectangle in the histogram</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/04/histogram.jpg" alt="" /></p>
<p><strong>Input:</strong> heights = [2,1,5,6,2,3]</p>
<p><strong>Output:</strong> 10</p>
<p><strong>Explanation:</strong> The above is a histogram where width of each bar is 1. The largest rectangle is shown in the red area, which has an area = 10 units.</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/04/histogram-1.jpg" alt="" /></p>
<p><strong>Input:</strong> heights = [2,4]</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= heights.length <= 10<sup>5</sup></code></li>
<li><code>0 <= heights[i] <= 10<sup>4</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
largestRectangleArea
public int largestRectangleArea(int[] heights)
-