LeetCode 新题又更新了,最大子数组乘积
题目分析:求一个数组,连续子数组的最大乘积。...
分类:
其他好文 时间:
2014-10-06 15:26:40
阅读次数:
175
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-10-05 23:13:59
阅读次数:
166
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.
点击打开原题链接
这个题剑指offer里也有,简单的递归即可,代码很清晰:...
分类:
其他好文 时间:
2014-10-05 22:56:09
阅读次数:
185
题目:Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product. For example, g...
分类:
其他好文 时间:
2014-10-05 21:45:29
阅读次数:
198
最大似然估计是一种非常有效的参数估计的数学方法,常用于在主题建模等领域。其思想是,对于已知的样本,假设它服从某种模型,估计模型中未知的参数,使该模型出现这些样本的概率最大。...
分类:
其他好文 时间:
2014-10-05 15:26:18
阅读次数:
173
论文里面的神题,题意大概是找出当前字符串中的一个子串,使得这个子串由N个字符串循环构成,输出N最大的子串,如果有多输出字典序最小的一个。解决方法感觉很犀利。。首先,对于循环节长度为L的子串,必然有这个子串会经过str[0],str[L],str[2*L]...中的任意两个字符,也就是必然会经过str...
分类:
其他好文 时间:
2014-10-04 23:57:07
阅读次数:
319
Yaoge’s maximum profitTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 442Accepted Submission(s): ...
分类:
其他好文 时间:
2014-10-04 13:04:46
阅读次数:
246
给定一个二叉树,求它的最大深度。最大深度是沿从根节点,到叶节点最长的路径。...
分类:
其他好文 时间:
2014-10-04 01:10:05
阅读次数:
186
题目地址:Ural 1146
这题是求最大子矩阵和。方法是将二维转化一维。
首先用n*n的方法来确定矩阵的列。需要先进行预处理,只对每行来说,转化成一维的前缀和,这样对列的确定只需要前后两个指针来确定,只需要用前缀和相减即可得到。前后两个指针用n*n的枚举。
确定好了哪几列,那么再确定行的时候就转化成了一维的最大连续子序列的和。再来一次O(n)的枚举就可以。
这样,总复杂就变成了O(n^3...
分类:
其他好文 时间:
2014-10-03 22:40:35
阅读次数:
205
题目Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete...
分类:
其他好文 时间:
2014-10-03 13:37:34
阅读次数:
225