2019-08-19 剑指 把数组排成最小的数

30min。python的魔法方法map函数,lambda方法,sort方法,还有排序的的思路


class Solution:
    def PrintMinNumber(self, numbers):
        l=map(lambda x:str(x),numbers)
        l.sort(cmp=lambda x,y:cmp(x+y,y+x))  #为什么x+y

你可能感兴趣的:(2019-08-19 剑指 把数组排成最小的数)