#K55377. 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 them such that they form the largest possible number when concatenated together.
For example, given the numbers [10, 2]
, the largest number is 210
and for [3, 30, 34, 5, 9]
, it is 9534330
.
Note: The result may be very large, so you should return it as a string.
inputFormat
The input is read from standard input (stdin) in the following format:
- The first line contains a single integer
n
, representing the number of integers. - The second line contains
n
non-negative integers separated by spaces.
outputFormat
Output a single line to standard output (stdout) containing the largest number that can be formed by concatenating the given integers.
## sample4
0 0 0 0
0