import functoolsclassSolution:deflargestNumber(self,nums: List[int]) ->str:defcomparator(s1,s2):ifint(s1+s2)<int(s2+s1):return-1ifint(s1+s2)>int(s2+s1):return1return0 nums = [str(i)for i in nums] nums =sorted(nums, key = functools.cmp_to_key(comparator), reverse=True) ans ='0'if nums[0]=='0'else''.join(nums)return ans