Maximum Sum Of M Non-overlapping Subarrays

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.
Input Format
A number N
arr1
arr2.. N numbers
Two numbers M and K
Output Format
A number representing maximum sum of M non-overlapping subarrays of size K.
Question Video
Constraints
1 <= N <= 10^3
1 <= arr[i] <= 10^3
M >= 1
K >= 1
N >= M*K
Sample Input
7
2 10 7 18 5 33 0
3
1
Sample Output
61


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name