题目:
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,...
分类:
编程语言 时间:
2014-12-28 14:17:01
阅读次数:
213
Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the l...
分类:
其他好文 时间:
2014-12-27 23:00:42
阅读次数:
421
Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number.ExampleGiven [-3, 1, 1, -3, 5...
分类:
其他好文 时间:
2014-12-27 06:42:21
阅读次数:
661
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 ...
分类:
其他好文 时间:
2014-12-27 06:41:35
阅读次数:
140
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...
分类:
其他好文 时间:
2014-12-25 09:55:31
阅读次数:
235
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 ...
分类:
其他好文 时间:
2014-12-25 08:44:08
阅读次数:
232
Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [...
分类:
其他好文 时间:
2014-12-20 20:51:21
阅读次数:
386
Minimum Subarray原题链接: http://lintcode.com/zh-cn/problem/minimum-subarray/#Given an array of integers, find the subarray with smallest sum.Return the s...
分类:
其他好文 时间:
2014-12-19 19:05:04
阅读次数:
250
Subarray Sum 原题链接:http://lintcode.com/zh-cn/problem/subarray-sum/#Given an integer array, find a subarray where the sum of numbers is zero. Your code ...
分类:
其他好文 时间:
2014-12-19 19:02:40
阅读次数:
357
之前好像做过这样的,以前是加法,现在是乘法。一开始我也傻逼得用n方的试了下,肯定是TLE的。那显然就是可以O(n)解决了用两个dp数组,一个存最大值,一个存最小值,因为可能是负数再乘以负数就很大了,所以每次更新需要借助最小值一同更新最大值。最后遍历一边dp大的数组就有答案了。class Soluti...
分类:
其他好文 时间:
2014-12-18 11:47:43
阅读次数:
152