Maximum Sum Of Two Non-overlapping Subarrays
medium
1. You are given an array(arr) of positive numbers and two numbers X and Y. 2. You have to find the maximum sum of elements in two non-overlapping subarrays. 3. One subarray must of length X and the other must be of length Y.
Constraints
1 <= N <= 1000 0 <= arr[i] <= 1000 X >= 1, Y >= 1 X + Y <= N
Format
Input
A number N arr1 arr2.. N numbers Two numbers X and Y
Output
A number representing maximum sum of elements in two non-overlapping subarrays.
Example
Sample Input
9
0 6 5 2 2 5 1 9 4
1
2
Sample Output
20