Largest Number

Problem Id: 179 Difficulty: Medium


Intuition

Solution


class Solution(object):
    def largestNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: str
        """
        nodes = [Node(n) for n in nums]
        nodes.sort(reverse=True)
        s = ''.join(n.value for n in nodes)
        start = 0
        while start < len(s) - 1 and s[start] == '0':
            start += 1
        return s[start:]