Smallest Joined Number
nums is a list of positive integers. Write them one after another, in an order of your choice and without separators, to form one long string of digits; every item is used exactly once.
Return the smallest string that can be formed, where strings are compared as numbers (all orders give the same length, so this is the usual string comparison). The result may be too long for an integer, so return it as a string. The smallest string is unique, so no tie rule is needed. Return the empty string for an empty list.
Example 1
30 goes before 3 because 303 beats 330; after that 34, 5 and 9 follow in order.
Example 2
102 beats 210, so 10 goes first.
Constraints
0 <= len(nums) <= 301 <= nums[i] <= 1000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.