 Max Sum Subarray of size K
##### Submissions: 2901   Accuracy: 54.7%   Difficulty: Basic   Marks: 1

Given an array of integers and a number K. Write a program to find the maximum sum of a subarray of size K.

Input:
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.
Output:
For each test case print the maximum sum of a subarray of size K.

Constraints:
1<=T<=100
1<=N<=105
1<=K<=N

Example:
Input:
2
4 2
100 200 300 400
9 4
1 4 2 10 23 3 1 0 20
Output:
700
39

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal
Author: harsh.agarwal0

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.