Given an arraynumsand a target valuek, find the maximum length of a subarray that sums tok. If there isn't one, return 0 instead.Example 1:Givennums=[...
分类:
其他好文 时间:
2016-01-12 07:43:37
阅读次数:
219
题目: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...
分类:
编程语言 时间:
2016-01-09 12:23:58
阅读次数:
225
Given an array of integers, find the subarray with smallest sum.Return the sum of the subarray.Have you met this question in a real interview? YesExam...
分类:
其他好文 时间:
2016-01-09 07:32:10
阅读次数:
164
题目最大子数组差给定一个整数数组,找出两个不重叠的子数组A和B,使两个子数组和的差的绝对值|SUM(A) - SUM(B)|最大。返回这个最大的差值。样例给出数组[1, 2, -3, 1],返回 6注意子数组最少包含一个数挑战时间复杂度为O(n),空间复杂度为O(n)解题刚做了数组中两个子数组和的最...
分类:
编程语言 时间:
2016-01-06 23:29:58
阅读次数:
1243
题目最大子数组 II给定一个整数数组,找出两个不重叠子数组使得它们的和最大。每个子数组的数字在数组中的位置应该是连续的。返回最大的和。您在真实的面试中是否遇到过这个题?Yes样例给出数组[1, 3, -1, 2, -1, 2],这两个子数组分别为[1, 3]和[2, -1, 2]或者[1, 3, -...
分类:
编程语言 时间:
2016-01-06 21:59:59
阅读次数:
690
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead.Example 1:Given n...
分类:
其他好文 时间:
2016-01-06 06:45:16
阅读次数:
217
题目: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...
分类:
其他好文 时间:
2015-12-27 09:37:59
阅读次数:
191
问题: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...
分类:
其他好文 时间:
2015-12-23 00:30:52
阅读次数:
182
Given an array ofnpositive integers and a positive integers, find the minimal length of a subarray of which the sum ≥s. If there isn't one, return 0 i...
分类:
其他好文 时间:
2015-12-19 16:32:00
阅读次数:
173
Maximum Subarray DifferenceGiven an array with integers.Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest.Return the ...
分类:
其他好文 时间:
2015-12-18 08:02:30
阅读次数:
231