劍指offer-把數組排成最小的數python)

思路1: python2是 num.sort(cmp=lmb) 也能夠用lambda n1, n2:int(str(n1)+str(n2))-int(str(n2)+str(n1))表示升序排列 def mycmp1(x,y): #升序排列 return x-y def mycmp2(x,y): #降序排列 return y-xpython # -*- coding:utf-8 -*- class
相關文章
相關標籤/搜索