
Choose 'l', 'r' (1 <= 'l' <= 'r' <='N') and reverse the subarray from 'l' to 'r'.
Let 'N' = 5, 'K' = 3, 'A' = [4, 2, 1, 2, 2].
We can reverse the subarray from index 3 to 4 (1-based indexing).
Array becomes [4, 2, 2, 1, 2].
Our answer is 8.
First-line contains an integer 'T', which denotes the number of test cases.
For every test case:-
First-line contains two integers 'N' and 'K'.
Second-line contains 'N' space-separated integers, elements of array 'A'.
For each test case, Return the maximum possible sum of the prefix of this array of length 'K'.
You don’t need to print anything. Just implement the given function.
1 <= 'T' <= 10
1 <= 'K' <= 'N' <= 10^5
1 <= 'A[i]' <= 10^3
The Sum of 'N' overall test cases does not exceed 10^5.
Time Limit: 1 sec
Algorithm:-