You are given an array of size n. You need to find two elements(pair) whose sum is minimum and two elements(pair) whose sum is maximum. You need to output the min sum and max sum.
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows. Each testcase contains size of array n. The next line contains the elements of the array.
For each testcase, print the min sum of pair and max sum of pair.
3 1 4 2
The total pairs of 3 with other elements are: (3,1); (3,4); (3,2). So sum = 4; 7; 5 respectively
The total pairs of 1 with other elements are: (1,4); (1,2). So sum = 5; 3 respectively
The total pairs of 4 with other elements are: (4,2). So sum = 6
Clearly, the min pair sum is 3 and the max pair sum is 7.