#K2176. Largest Number
Largest Number
Largest Number
Given a list of non-negative integers, arrange them such that they form the largest possible number. More formally, given an array \(A = [a_1, a_2, \dots, a_n]\) where each \(a_i\) is a non-negative integer, you are to form a new number by concatenating the integers in some order such that the resulting number is maximized.
If the resulting number would have leading zeros (for example, when all numbers are zero), output a single '0'.
The input is read from stdin
and the output should be printed to stdout
.
inputFormat
The first line contains an integer \(n\) representing the number of non-negative integers. The second line contains \(n\) space-separated non-negative integers.
outputFormat
Output a single line representing the largest number that can be formed by concatenating the given integers.
## sample5
3 30 34 5 9
9534330
</p>