Given an array, find the subarray (containing at least k numbers) which has the largest sum. Return the sum.
[-4, -2, 1, -3]
and k = 2
should return -1
. The subarray is [-2, 1]
.
[1, 1, 1, 1, 1, 1]
and k = 2
should return 6
. The subarray is [1, 1, 1, 1, 1, 1]
.