classSolution:defminNumber(self,nums: List[int]) ->str:defcompare(num1,num2): a, b = num1 + num2, num2 + num1if a > b:return1elif a < b:return-1else:return0for i inrange(min(n1, n2)):if num1[i]> num2[i]:return1elif num1[i]< num2[i]:return-1return1if n1 < n2 else0if n1 == n2 else-1 max_count =max([len(str(num)) for num in nums]) new_nums =sorted([str(num) for num in nums], key=functools.cmp_to_key(compare))return''.join(new_nums)