Largest Concatenated Number
Arrange the non-negative integers in nums so that writing them one after another forms the largest possible number. Return that number as a string without leading zeros (all zeros give "0").
Example 1
Input: nums = [10, 2] Output: "210"
Example 2
Input: nums = [8, 81, 9] Output: "9881" Explanation: "881" beats "818", so 8 goes before 81.
Constraints
- 1 <= nums.length <= 10^4
- 0 <= nums[i] <= 10^9
Hint 1
Put a before b exactly when a + b (as strings) is larger than b + a.
Hint 2
If the result starts with 0, every number was 0.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Automation Test Engineer, Data Engineer
Run checks your code on 2 sample tests. Submit runs all 8 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.