Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the larges...
分类:
其他好文 时间:
2014-09-26 01:16:58
阅读次数:
271
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-09-25 15:11:49
阅读次数:
209
题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,...
分类:
编程语言 时间:
2014-09-25 13:26:28
阅读次数:
281
题目大意:给定一个序列,求区间第k小
注意是第k小!!别被题目描述骗到了!!这题求的是第k小!!不是第k大!!!
这题和POJ2104一样,都是求区间第k小,不同的是这题的序列是有重复的
对于有重复的,我们必须先预处理出有多少个中位数能进入左区间,否则就会导致过多的中位数堆积在左区间导致该进入左区间的东西被硬塞进了右区间
其实我只是想说为何网上的处理重复都写的那么麻烦。。。像我这样精简点不...
分类:
其他好文 时间:
2014-09-23 16:27:54
阅读次数:
213
The kth great number
Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the numb...
分类:
其他好文 时间:
2014-09-22 19:12:13
阅读次数:
197
题目:统计一个字母矩阵中最大的相同字母的面积,有些字母可以换成其他字母。
分析:dp,单调队列。计算分三种分别换成a,b,c求出最大的子矩阵,求出最大即可。
然后就是单调队列优化的查询算法了,确定每个点右(左)边第一个比他小的点;
T(N)=O(N^2)。
说明:(2011-09-19 08:15)。
#include
#include...
分类:
其他好文 时间:
2014-09-22 09:22:42
阅读次数:
206
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.难度:90 这是一道非常综合的题目,要求在0-1矩阵中找出面积最大...
分类:
其他好文 时间:
2014-09-22 07:45:22
阅读次数:
189
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist...
分类:
其他好文 时间:
2014-09-22 02:12:11
阅读次数:
245
题目:给你一些不同高度的宽度为1的木板,问能截取最大矩形面积。
分析:dp,单调队列。关键在于找到每个高度的最大连续长度,最大面积了 O(N*max(L),R));
如果暴力的话,则代价为O(N),则总代价为O(N*N)无法处理100000数据量;
但是可用单调队列,做预处理 用O(N)时间计算出所有点的边界,此时时间复杂度为 O(N);...
分类:
其他好文 时间:
2014-09-21 23:23:01
阅读次数:
247
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-09-15 15:46:19
阅读次数:
183