
The first line of the input contains ‘T’ denoting the number of test cases.
The first line of each test case contains the three integers N, length of the array.
The second line of each test case contains N space-separated integers of the array A.
Return the result of each test case in a new line.
1 <= T <= 5
1 <= N <= 3000
1 <= A[i] <= 5000
Where ‘T’ denotes the number of test cases.
Explanation:
Algorithm: