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,...
分类:
其他好文 时间:
2015-03-15 02:00:27
阅读次数:
116
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-03-14 21:43:57
阅读次数:
145
Given an array of integers and a number k, find k non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguou...
分类:
其他好文 时间:
2015-03-14 12:16:06
阅读次数:
198
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]...
分类:
其他好文 时间:
2015-03-14 10:59:57
阅读次数:
122
Given an array with integers.Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest.Return the largest difference.NoteThe ...
分类:
其他好文 时间:
2015-03-14 06:11:46
阅读次数:
565
Given an array of integers, find two non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguous.Return the ...
分类:
其他好文 时间:
2015-03-14 06:10:35
阅读次数:
198
这道题需要明确一个思路,如果最终最大解的区间是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
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
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问题: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