1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/柱状图中最大的矩形 [largest-rectangle-in-histogram].html
2022-03-29 12:43:11 +08:00

33 lines
887 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定 <em>n</em> 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。</p>
<p>求在该柱状图中,能够勾勒出来的矩形的最大面积。</p>
<p> </p>
<p><strong>示例 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/04/histogram.jpg" /></p>
<pre>
<strong>输入:</strong>heights = [2,1,5,6,2,3]
<strong>输出:</strong>10
<strong>解释:</strong>最大的矩形为图中红色区域,面积为 10
</pre>
<p><strong>示例 2</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2021/01/04/histogram-1.jpg" /></p>
<pre>
<strong>输入:</strong> heights = [2,4]
<b>输出:</b> 4</pre>
<p> </p>
<p><strong>提示:</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>