码迷,mamicode.com
首页 >  
搜索关键字:maximum    ( 4142个结果
LeetCode——Best Time to Buy and Sell Stock II (股票买卖时机问题2)
问题: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may co...
分类:其他好文   时间:2014-10-10 00:18:11    阅读次数:398
【RMQ】 区间最值查询详解
1.概述RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,jO(nlogn){for(int j = 1; j #include #include using namespace std;c...
分类:其他好文   时间:2014-10-09 23:36:27    阅读次数:627
Binary Tree Maximum Path Sum [leetcode] dp
a(i):以节点i作为终点的单边最大路径和 b(i):以节点i作为终点的双边边最大路径和 a(i) = max{ i->val, i->val + max{a(i->left), a(i->right) }}; b(i) = max{ i->val, i->val + max{a(i->left), a(i->right) } , i->val + a(i->left) + a(...
分类:其他好文   时间:2014-10-09 22:49:47    阅读次数:141
[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...
分类:其他好文   时间:2014-10-09 16:59:57    阅读次数:203
Binary Tree Maximum Path Sum
[leetcode]Given a binary tree, find the maximum path sum....
分类:其他好文   时间:2014-10-09 16:29:28    阅读次数:161
leetcode Maximum Subarray 最大子序列
Maximum Subarray  Total Accepted: 28381 Total Submissions: 83696 My Submissions Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For exam...
分类:其他好文   时间:2014-10-09 16:27:18    阅读次数:237
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...
分类:其他好文   时间:2014-10-09 01:08:37    阅读次数:231
LeetCode: Maximum Product Subarray
很久没练只能看别人代码了 1 class Solution { 2 public: 3 int maxProduct(int A[], int n) { 4 if (n == 0) return 0; 5 int curMax, curMin, ans; 6 ...
分类:其他好文   时间:2014-10-09 00:48:07    阅读次数:218
Maximum Subarray (JAVA)
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-10-09 00:23:07    阅读次数:218
[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...
分类:其他好文   时间:2014-10-08 18:06:55    阅读次数:163
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!