LeetCode: Largest Rectangle in Histogram
摘要:
Givennnon-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.本来的想法就是最naive的想法。对应每一个bar,在它的左右两侧延伸,直到遇到一个比这个值小的bar,计算面积。可以通过,就是时间比较长。后来在网上看到一种O(n)的算法。。我发现很多我做出来的题都不是最优的算法,都是一些naive的算法。Actually, we can decr 阅读全文
posted @ 2014-01-26 23:47 longhorn 阅读(169) 评论(0) 推荐(0) 编辑