The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
The legendary Sherlock Holmes needs your help in solving a case. He has been trying to solve the case of The Lost Number for a long time and using his exceptional skills, has been able to discover all N parts of the number. He also knows that the Lost Number is the arrangement of these N parts, that results in the numerically maximum number.
Since he is very busy with other cases, he needs you to use your coding skills to help him find The Lost Number. Given N numbers K1 K2 K3…Kn, output the biggest number that can be formed by joining these N numbers.
First line of the input contains the number of test cases T.
For each test case there are 2 lines of input-
The first line contains an integer N.
The second line contains N space separated numbers Ki.
For each test case output a single line containing the maximum number that can be formed.
1
1
1
Input: 3 3 4 1 8 2 231 942 2 59 542 Output: 841 942231 59542 Explanation for the second test case: 231 and 942 can have 2 possible arrangements 231942 and 942231. Since 942231>231942, the correct answer is 942231.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll