码迷,mamicode.com
首页 >  
搜索关键字:maximum    ( 4142个结果
Maximum Subarray
这道题需要明确一个思路,如果最终最大解的区间是i,j,那么,对于i和j中任一一个值k,有这样的性质,从i到k的和一定不能小于0。知道这个性质后,程序就比较简单了。class Solution {public: int maxSubArray(int A[], int n) { i...
分类:其他好文   时间:2015-03-14 00:58:44    阅读次数:140
[LeetCode]Maximum Product Subarray
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 th...
分类:其他好文   时间:2015-03-13 23:49:17    阅读次数:249
LeetCode Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine i...
分类:其他好文   时间:2015-03-13 20:48:48    阅读次数:118
Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum问题:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.思路: dfs我的代码:public c....
分类:其他好文   时间:2015-03-13 12:26:01    阅读次数:114
LeetCode Maximum Subarray
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,?5,4], the contiguous subarray [4,?1,2,1] ha...
分类:其他好文   时间:2015-03-13 00:28:08    阅读次数:187
Maximum Depth of Binary Tree
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 le...
分类:其他好文   时间:2015-03-13 00:14:25    阅读次数:141
【LeetCode】Maximum Subarray
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,?5,4], the contiguous subarray [4,?1,2,1] has the largest sum = 6....
分类:其他好文   时间:2015-03-12 22:42:13    阅读次数:158
[LeetCode] Best Time to Buy and Sell Stock II 贪心算法
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 a...
分类:编程语言   时间:2015-03-12 20:45:30    阅读次数:144
LeetCode Maximum Subarray
1.题目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,?5,4],the contiguous subarray [4,?1,2,1] has...
分类:其他好文   时间:2015-03-12 11:38:49    阅读次数:120
LeetCode --- 55. Jump Game
题目链接:Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. ...
分类:其他好文   时间:2015-03-12 11:38:00    阅读次数:123
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!