You are given a list of non-negative whole numbers nums. Write all of them one after another, each exactly once and without changing any number's digits, so that the digits read as the largest possible number. You choose only the order.
The result can be far too long for any integer type, so return it as a string of digits. It must not start with a 0 unless the whole answer is "0".
9 goes first. 4 comes before 42 because 442 beats 424, and 42 comes before 400 because 42400 beats 40042.
Starting with the biggest number is not the rule: 717 must go before 71, since 71771 beats 71717.
Every order spells 000, which is the number zero, so the answer is the single digit "0".
Constraints
1 <= nums.length <= 1000 <= nums[i] <= 10⁹To decide which of two numbers goes first, try both orders: write a then b, then b then a, and keep whichever reads larger. That one rule settles the whole order.