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<y+x不行啊
return "".join(l)
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<y+x不行啊
return "".join(l)
本文标题:2019-08-19 剑指 把数组排成最小的数
本文链接:https://www.haomeiwen.com/subject/axlysctx.html
网友评论