Stack
再见小小ronnie
这个作者很懒,什么都没留下…
展开
-
Leetcode 85. Maximal Rectangle
/** * Scan row by row. * Calculate the histogram for each row. e.g. for row 2 the histogram is 2, 0, 2, 1, 1 * Calculate the largest area of this histogram. */ public class Solution { public转载 2017-03-03 12:55:46 · 238 阅读 · 0 评论 -
Leetcode 155. Min Stack
Using two stacks, one to save elements, and the other to save the minimum. Therefore, there is a mapping between an element and current minimum. stack min -1转载 2017-03-07 04:37:30 · 166 阅读 · 0 评论 -
Leetcode 84. Largest Rectangle in Histogram
/** * Basic idea is using a stack to record the ascending heights in the given array. * Every time meet a height that is smaller than the previous one, pop out the statck, find the maximum area from转载 2017-03-03 11:45:46 · 185 阅读 · 0 评论