Skip to content

Commit 4694c0b

Browse files
Added README.md file for Largest Rectangle in Histogram
1 parent 624fa9b commit 4694c0b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<h2><a href="https://leetcode.com/problems/largest-rectangle-in-histogram">Largest Rectangle in Histogram</a></h2> <img src='https://img.shields.io/badge/Difficulty-Hard-red' alt='Difficulty: Hard' /><hr><p>Given an array of integers <code>heights</code> representing the histogram&#39;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>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
<img alt="" src="https://assets.leetcode.com/uploads/2021/01/04/histogram.jpg" style="width: 522px; height: 242px;" />
6+
<pre>
7+
<strong>Input:</strong> heights = [2,1,5,6,2,3]
8+
<strong>Output:</strong> 10
9+
<strong>Explanation:</strong> The above is a histogram where width of each bar is 1.
10+
The largest rectangle is shown in the red area, which has an area = 10 units.
11+
</pre>
12+
13+
<p><strong class="example">Example 2:</strong></p>
14+
<img alt="" src="https://assets.leetcode.com/uploads/2021/01/04/histogram-1.jpg" style="width: 202px; height: 362px;" />
15+
<pre>
16+
<strong>Input:</strong> heights = [2,4]
17+
<strong>Output:</strong> 4
18+
</pre>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>1 &lt;= heights.length &lt;= 10<sup>5</sup></code></li>
25+
<li><code>0 &lt;= heights[i] &lt;= 10<sup>4</sup></code></li>
26+
</ul>

0 commit comments

Comments
 (0)