Arrange non-negative integers so their concatenation forms the largest possible number.
Given an array of non-negative integers, reorder the numbers so that when their decimal representations are concatenated, they form the largest possible integer-like string.
Your task is to return that maximum concatenation as a string.
Because the result may exceed standard integer limits, the answer must be handled as text rather than a numeric type.
nums of non-negative integers.nums.1 <= nums.length0 <= nums[i]"0".Example 1
Input
[10,2]
Output
"210"
Explanation
Comparing "10" and "2": placing "2" before "10" gives "210", which is larger than "102".
Example 2
Input
[3,30,34,5,9]
Output
"9534330"
Explanation
A best ordering is [9, 5, 34, 3, 30], which concatenates to 9534330.
Example 3
Input
[0,0]
Output
"0"
Explanation
All concatenations start with zeros, so the normalized answer is just 0.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.