
The first line of input contains an integer 'T' representing the number of test cases.
The first line of each test case contains one integer ‘N’ denoting the number of elements in the array.
The second line of each test case contains N space-separated integers denoting the elements of the array ARR.
For each test case, on a separate line, output one integer - the minimum possible sum of numbers.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 50
1 <= N <= 10^4
0 <= A[i] <= 9
Where ‘T’ is the number of test cases, ‘N’ is the size of the given array, and ‘ARR[i]’ denotes the ith element of the array.
Time limit: 1 sec
The idea is to sort the array in ascending order and then concatenate the array elements alternatively to the first and the second number. So, the first number is formed by the elements present in the even position and the second number is formed by the elements present in the odd position. The sum of the first and the second number will be the minimum sum.
The algorithm is as follows :