#K88047. Largest Concatenated Number
Largest Concatenated Number
Largest Concatenated Number
You are given T test cases. Each test case starts with an integer N followed by N integers. Your task is to arrange the given integers such that when concatenated together, they form the largest possible number.
To solve this problem, consider two numbers x and y as strings. Compare the concatenated strings x+y and y+x lexicographically. If x+y is greater than y+x, then x should come before y in the ordering.
The final result should not contain any leading zeros (unless the result is exactly zero). Formally, for any two numbers, you should ensure that the following inequality holds: \[ x+y \geq y+x \] where the addition here represents string concatenation.
inputFormat
The input is read from standard input. The first line contains an integer T, the number of test cases. For each test case, the first line contains an integer N, representing the number of elements. This is followed by N lines, each containing one integer.
outputFormat
For each test case, output a single line containing the largest concatenated number.
## sample2
2
3
30
3
9
92
5
330
9925
</p>