目录

力扣84. 柱状图中最大的矩形

力扣84. Largest Rectangle in Histogram(柱状图中最大的矩形)

给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1。求在该柱状图中,能够勾勒出来的矩形的最大面积。

示例 1:

../posts/01_学习/87_LeetCode/0084_柱状图中最大的矩形/img/0084-1-description.png

输入:heights = [2,1,5,6,2,3]
输出:10

示例 2:

../posts/01_学习/87_LeetCode/0084_柱状图中最大的矩形/img/0084-2-description.png

输入:heights = [2,4]
输出:4

提示:

  • 1 <= heights.length <= 10^5
  • 0 <= heights[i] <= 10^4