leetcode 上的一道题:Largest Number

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

class Solution:
    # @param num, a list of integers
    # @return a string
    def largestNumber(self, num):
        num = [str(x) for x in num]
        print num
        num.sort(cmp=lambda x, y: cmp(y+x, x+y))
        return ''.join(num).lstrip('0') or '0'