Given an array of digits (values are from 0 to 9), find the minimum possible sum of two numbers formed from digits of the array. All digits of given array must be used to form the two numbers.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. First line of each test case contains an integer N denoting the size of the array. Next line of each test contains N space seperated integers denoting the elements of the array.
For each test case output a single line containing the required sum.
6 8 4 5 2 3
5 3 0 7 4
Test Case 1-
The minimum sum is formed by numbers 358 and 246
Test Case 2 -
The minimum sum is formed by numbers 35 and 047
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.