Given an array and a number k, find the sum of all the subarrays of size k.
Array: [3, 5, 6, 2, 4, 7, 8]
k: 3
Here, the subarrays of size k and their sum are:
[3 5 6] => 14
[5 6 2] => 13
[6 2 4] => 12
[2 4 7] => 13
[4 7 8] => 19
Answer: [14, 13, 12, 13, 19]
The first line contains an integer âTâ denoting the number of test cases.
For each test case, the input contains two lines:
For each test-cases, the output has n - k + 1 number denoting the elements of the resultant array.
2
7 3
3 5 6 2 4 7 8
6 1
1 3 3 3 4 4
14 13 12 13 19
1 3 3 3 4 4
1 <= T <= 100
1 <= n <= 104
1 <= k <= n
1 <= Ai <= 104