Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.

Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].

The largest rectangle is shown in the shaded area, which has area = 10 unit.
Example:
Input: [2,1,5,6,2,3] Output: 10
转载:https://www.cnblogs.com/love-yh/p/7182920.html
最大直方图面积算法解析
本文介绍了一种计算直方图中最大矩形面积的方法。给定一系列非负整数表示直方图的高度,宽度均为1,目标是找出最大的矩形区域并计算其面积。示例输入为[2,1,5,6,2,3],输出的最大面积为10。通过实例讲解了算法的具体应用。
898

被折叠的 条评论
为什么被折叠?



