from functools import cmp_to_keyclass Solution: def solve(self,nums): strs=map(str,nums) # 将整型的数字转化为字符串 def cmp1(x, y): # x=20,y=4 if y+x> x+y: # 如果420>204,交换20和4的位置,变成4和20 return 1 else: return -1 temp = sorted(strs, key=cmp_to_key(cmp1)) return "".join(temp if temp[0] != '0' else '...