
算法-单调栈
文章平均质量分 75
BrcLi
这个作者很懒,什么都没留下…
展开
-
LeetCode 84. Largest Rectangle in Histogram 单调栈应用
单调栈即栈内元素必须单调增或者单调减,假设有数组arr[2,1,5,6,2,3],求数组中每个数字左右两边离他最近的比他小的数, 2: 左边—无 右边—11: 左边—无 右边—无5: 左边—1 右边—2。。。最容易想到的方法是对于每个数字,分别从左遍历到此位置找到左边最近且最小的数字,从右遍历到此位置找到右边最近且最小的数字,对于原创 2017-08-17 10:04:30 · 954 阅读 · 0 评论 -
leetcode:739. Daily Temperatures 单调栈
Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which thi原创 2017-12-20 22:42:25 · 1478 阅读 · 0 评论