551. Maximum Subarray Sum II
0
Hard
Given an array of n integers, find the maximum sum of values in a contiguous subarray with a length between a and b.
Input Format
The first line of input contains three integers: n, a, and b, representing the size of the array and the minimum and maximum subarray length, respectively.
The second line of input contains n integers x1, x2, ..., xn, representing the array values.
The second line of input contains n integers x1, x2, ..., xn, representing the array values.
Output Format
Print a single integer, the maximum subarray sum.
Example
Input
4 1 3
1 2 2 1
Output
5
Constraints
1<= N <= 2.105
1<= a<= b<= N
-109<= nums[i] <= 109
1<= a<= b<= N
-109<= nums[i] <= 109
Loading...
View Submissions
Console