Largest Concatenation
Arrange the numbers in some order and concatenate their decimal representations. Print the largest number you can form (as a string, no leading zeros unless the value is 0).
Input: the first line has N; the second line has N non-negative integers.
Output: the largest concatenation.
Constraints:
- 1 ≤ N ≤ 104
- 0 ≤ ai ≤ 1000
Sample Tests
Input 1
3 10 2 9
Output 1
9210
Input 2
2 0 0
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.