Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to us...
分类:
其他好文 时间:
2014-08-03 23:10:36
阅读次数:
179
题目:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to ....
分类:
编程语言 时间:
2014-08-03 05:24:06
阅读次数:
304
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2112The Company Dynamic Rankings has developed a new kind of computer that is no lon...
分类:
其他好文 时间:
2014-08-02 01:37:22
阅读次数:
582
Problem Description
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the fi...
分类:
其他好文 时间:
2014-08-01 09:16:21
阅读次数:
280
给出动态更新数据,实时问第K个大的数值是什么?
利用AVL数据结构做的一个统计数,比较高级的数据结构内容了。
不知道题目给出的数据值是否有重复,因为我下面的程序是可以处理出现数据重复的情况的。
其中的奥妙是增加了repeat的信息,可以知道出现了当前数组多少次。
主要是知道如何维护这些数据和如何查询,维护数据的函数是pushUp,查询函数是selectKth。
其他就是一般的AVL操作。...
分类:
其他好文 时间:
2014-08-01 00:07:00
阅读次数:
273
题目: 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...
分类:
编程语言 时间:
2014-07-30 05:34:43
阅读次数:
319
这三道题的关系是这样的,1505是1506的加强版,2870又是1505的加强版如果按照上面由简到易的顺序来做的话,还是很简单的这道题的思想就是 枚举+DP因为某些字符可以变值,所以我们枚举a, b, c三个矩阵分别求出对应的h数组以及最大子矩阵,再在里面求出一个最大值即可。 1 //#define...
分类:
其他好文 时间:
2014-07-30 03:14:02
阅读次数:
201
这个问题姑且也叫做最大子矩阵吧给一个树状图,求一个最大面积的子矩阵思路是这样的,对于每个单位矩阵,求出左边连续不比它低的矩阵的下标,放在l数组里同样,再求出右边连续的不比它低的矩阵的下标这样,对于每个单个矩阵所能得到的最大面积就是(r[i]-l[i]+1)*a[i] 1 //#define LOCA...
分类:
其他好文 时间:
2014-07-29 20:54:32
阅读次数:
158
盗用名字:C题题目都没看懂, B:You are given a long longn. Return the largest divisor ofnthat is a perfect square. That is, the correct return value is x if and ...
分类:
其他好文 时间:
2014-07-29 10:54:36
阅读次数:
204
题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.题解:这道题可以应用之前解过的Largetst Recta....
分类:
编程语言 时间:
2014-07-26 09:55:57
阅读次数:
301