#K57342. Form the Largest Number
Form the Largest Number
Form the Largest Number
You are given a list of non-negative integers. Your task is to arrange these integers such that when concatenated, they form the largest possible number.
To solve the problem, notice that for any two numbers represented as strings \(a\) and \(b\), the order between them should be determined by comparing \(a+b\) and \(b+a\). In other words, if \(a+b \geq b+a\), then \(a\) should come before \(b\) in the final arrangement.
If the resulting number begins with one or more zeros, it should be output as a single zero.
Example:
For the input list [3, 30, 34, 5, 9], the largest formed number is 9534330.
inputFormat
The first line of input is an integer \(n\) representing the number of elements. The second line contains \(n\) non-negative integers separated by spaces.
outputFormat
Output the largest possible number (as a string) formed by concatenating the array elements.
## sample5
3 30 34 5 9
9534330