题目描述
blablabla
样例
blablabla
算法1
() $O(n^2)$
blablabla
时间复杂度分析:blablabla
P代码
class Solution(object):
def printMinNumber(self, nums):
"""
:type nums: List[int]
:rtype: str
"""
nums_l = [ConcatNum(num) for num in nums]
nums_l.sort(reverse = False)
nums_l = map(str, nums_l)
return ''.join(nums_l).lstrip('0') or ''
class ConcatNum:
def __init__(self, number):
self.num = number
def __gt__(self, other):
return str(self.num) + str(other.num) > str(other.num) + str(self.num)
def __eq__(self, other):
return str(self.num) + str(other.num) == str(other.num) + str(self.num)
def __str__(self):
return str(self.num)