# Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.
#
# Since the result may be very large, so you need to return a string instead of an integer.
#
#  
# Example 1:
#
#
# Input: nums = [10,2]
# Output: "210"
#
#
# Example 2:
#
#
# Input: nums = [3,30,34,5,9]
# Output: "9534330"
#
#
#  
# Constraints:
#
#
# 	1 <= nums.length <= 100
# 	0 <= nums[i] <= 109
#
#


class Solution:
    def largestNumber(self, nums: List[int]) -> str:
        from functools import cmp_to_key
        def cmp1(a, b):
            if a == b:
                return 0
            if a + b > b + a:
                return 1
            else:
                return -1
        snum = [str(n) for n in nums]
        snum = sorted(snum, key=cmp_to_key(cmp1), reverse=True)
        return ''.join(snum) if snum[0] != '0' else '0'

290c453c47ae467e33af58a16787a9eade999216
<mask token>

class Solution:
    <mask token>

class Solution:

    def largestNumber(self, nums: List[int]) ->str:
        from functools import cmp_to_key

        def cmp1(a, b):
            if a == b:
                return 0
            if a + b > b + a:
                return 1
            else:
                return -1
        snum = [str(n) for n in nums]
        snum = sorted(snum, key=cmp_to_key(cmp1), reverse=True)
        return ''.join(snum) if snum[0] != '0' else '0'

# Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.
#
# Since the result may be very large, so you need to return a string instead of an integer.
#
#  
# Example 1:
#
#
# Input: nums = [10,2]
# Output: "210"
#
#
# Example 2:
#
#
# Input: nums = [3,30,34,5,9]
# Output: "9534330"
#
#
#  
# Constraints:
#
#
# 	1 <= nums.length <= 100
# 	0 <= nums[i] <= 109
#
#


class Solution:
    def largestNumber(self, nums: List[int]) -> str:
        from functools import cmp_to_key
        def cmp1(a, b):
            if a == b:
                return 0
            if a + b > b + a:
                return 1
            else:
                return -1
        snum = [str(n) for n in nums]
        snum = sorted(snum, key=cmp_to_key(cmp1), reverse=True)
        return ''.join(snum) if snum[0] != '0' else '0'
