Given an array of integers and a number K. Write a program to find the maximum sum of a subarray of size K.
First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains two space separated integers N and K where N denotes the number of elements. Second line of each test case contains N space separated integers which denotes the elements of the array.
For each test case print the maximum sum of a subarray of size K.
100 200 300 400
1 4 2 10 23 3 1 0 20
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.