单调结构
Frontier_Setter
这个作者很懒,什么都没留下…
展开
-
USACO 6.1.2 A Rectangular Barn 单调栈
http://train.usaco.org/usacoprob2?S=rectbarn&a=iHzQON4VeJX题目大意:一个R*C的方格阵,有P个无效格,求不包含无效格的矩形的最大面积错误想法一:①对每个位置求出离他最近的左侧无效格到他的距离 ②遍历每个格子,向上伸展直到遇到无效格,在这个过程中计算以该长条为边的矩形的面积时间复杂度是N^3的,而且需要一个R*C的数组,在这道题里是3...原创 2018-02-10 23:22:17 · 305 阅读 · 0 评论 -
[LeetCode] (medium) 402. Remove K Digits
https://leetcode.com/problems/remove-k-digits/ Given a non-negative integernumrepresented as a string, removekdigits from the number so that the new number is the smallest possible. Note: The ...原创 2019-04-29 17:32:28 · 106 阅读 · 0 评论 -
[LeetCode] (medium) 456. 132 Pattern
https://leetcode.com/problems/132-pattern/ Given a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, aksuch thati<j<kand ai< ak< aj. Design an algor...原创 2019-05-08 20:43:54 · 90 阅读 · 0 评论