Maximum Sum Of M Non-overlapping Subarrays
hard
1. You are given an array(arr) of positive numbers and two numbers M and K. 2. You have to find the maximum sum of M non-overlapping subarrays of size K. 3. The size of the given array(arr) is greater than M*K.
Constraints
1 <= N <= 10^3 1 <= arr[i] <= 10^3 M >= 1 K >= 1 N >= M*K
Format
Input
A number N arr1 arr2.. N numbers Two numbers M and K
Output
A number representing maximum sum of M non-overlapping subarrays of size K.
Example
Sample Input
7
2 10 7 18 5 33 0
3
1
Sample Output
61