求二叉树深度。【思路】很简单,二叉树经典。用递归求左树右树的深度,较大值加1即可。【other code】int maxDepth(TreeNode *root) { if(root==NULL) return 0; //if(maxDepth(ro...
分类:
其他好文 时间:
2015-04-22 23:53:08
阅读次数:
165
传送门:http://poj.org/problem?id=3693
题目:给出一个串,求重复次数最多的连续重复子串;
分析:
枚举重复单元的长度,然后理所当然的枚举起点。利用rmq处理,后缀i,i+l的最长前缀。
lcp/l+1,为当前相邻l长度单元的串的重复次数,但是由于i+=l,提高了效率,但是i不一定刚好是重复串的起点,所以如果r%l!=0,把串往前移l-r%l个单位。找到...
分类:
编程语言 时间:
2015-04-22 09:36:52
阅读次数:
178
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...
分类:
其他好文 时间:
2015-04-21 23:59:29
阅读次数:
343
Hadoop调优mapred.tasktracker.map.tasks.maximum官方解释:The maximum number of map tasks that will be runsimultaneously by a task tracker.我的理解:一个tasktracker最多...
分类:
其他好文 时间:
2015-04-21 17:50:58
阅读次数:
122
problem:
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Hide Tags
Tr...
分类:
其他好文 时间:
2015-04-21 11:20:10
阅读次数:
108
在网页的中增加以上这句话,可以让网页的宽度自动适应手机屏幕的宽度:1 1、width=device-width :表示宽度是设备屏幕的宽度2、initial-scale=1.0:表示初始的缩放比例3、minimum-scale=0.5:表示最小的缩放比例4、maximum-scale=2.0:表示....
分类:
移动开发 时间:
2015-04-20 20:34:54
阅读次数:
136
非极大抑制(Non-maximum suppression)在物体检测领域的应用...
分类:
其他好文 时间:
2015-04-20 17:00:33
阅读次数:
1332
RMQ (Range Minimum/Maximum Query):对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j里的最小(大)值,也就是说,RMQ问题是指求区间最值的问题。
分类:
编程语言 时间:
2015-04-19 17:50:40
阅读次数:
181
1. (可选)如要扩展视图对应的模型请增加相应的字段,如: class product(models.Model): _inherit = "product.product" max_quantity = fields.Float(string="Maximum Quantity") //增加了一个最大数量字段 1....
分类:
其他好文 时间:
2015-04-19 09:00:51
阅读次数:
313
转自:http://blog.csdn.net/lilongherolilong/article/details/6624390先挖好坑,明天该去郑轻找虐RMQ(Range Minimum/Maximum Query)问题是求区间最值问题。你当然可以写个O(n)的(怎么写都可以吧=_=),但是万一要...
分类:
编程语言 时间:
2015-04-18 21:45:17
阅读次数:
154