221 medium 221. Maximal Square Medium Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its are ...
分类:
其他好文 时间:
2019-08-06 20:01:38
阅读次数:
68
Red and Black Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 50913 Accepted: 27001 Description There is a rectangular room, covered with s ...
分类:
其他好文 时间:
2019-08-02 18:14:18
阅读次数:
105
单调栈和队列讲解:传送门 HDU -1506题意: 就是给你一些矩形的高度,让你统计由这些矩形构成的那个矩形面积最大 如上图所示,如果题目给出的全部是递增的,那么就可以用贪心来解决 从左向右依次让每一个矩形的高度当作最后的高度,来从中选取最大值就可以了 但是如果它不是递增的,中间会出现低谷,那么要还 ...
分类:
其他好文 时间:
2019-07-31 18:59:28
阅读次数:
110
刷 July 27 2019 这个题做了好久,面试遇到就跪了,只会暴力解。 而且也讲不明白。简单说就是用stack保证递增: 添加2,下一个是1,不递增了,POP出2然后算结果是乘积是2. 继续添加1 5 6,然后下一个是2,不递增了,POP出6和5算乘积是6和10. 添加2和3,此时STACK里是 ...
分类:
其他好文 时间:
2019-07-28 15:56:11
阅读次数:
76
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he c ...
分类:
其他好文 时间:
2019-07-25 00:55:44
阅读次数:
150
原题目链接:http://poj.org/problem?id=2559 解题思路: 用单调栈求任意每个区间的最小值及区间长度,为什么记录区间最小值呢?(木桶装水原理,装水量取决于最短木板长)。枚举每个区间,维护最大答案。 //自行百度单调栈 AC代码: ...
分类:
其他好文 时间:
2019-07-24 13:44:21
阅读次数:
91
嗯... 题目链接:http://poj.org/problem?id=2559 一、单调栈: 1.性质: 单调栈是一种特殊的栈,特殊之处在于栈内的元素都保持一个单调性,可能为单调递增,也可能为单调递减。 2.模样: 这是一个单调递增的栈,如果我们插入的元素大于栈顶元素,则直接入栈; 如果我们插入的 ...
分类:
其他好文 时间:
2019-07-22 15:19:08
阅读次数:
85
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Given an inte ...
分类:
其他好文 时间:
2019-07-21 23:44:53
阅读次数:
139
题目描述 Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy ...
分类:
其他好文 时间:
2019-07-17 12:46:57
阅读次数:
118
Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From ...
分类:
其他好文 时间:
2019-07-16 20:05:48
阅读次数:
148