mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
37 lines
1.2 KiB
HTML
37 lines
1.2 KiB
HTML
<p>给定非负整数数组 <code>heights</code> ,数组中的数字用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 <code>1</code> 。</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>
|
||
|
||
<p> </p>
|
||
|
||
<p><meta charset="UTF-8" />注意:本题与主站 84 题相同: <a href="https://leetcode-cn.com/problems/largest-rectangle-in-histogram/">https://leetcode-cn.com/problems/largest-rectangle-in-histogram/</a></p>
|