时间复杂度:O(N^2)
空间复杂度:O(N)

#
# 最大数
# @param nums int整型一维数组
# @return string字符串
#
class Solution:
    def solve(self , nums ):
        # write code here
        n = len(nums)
        for cnt in range(n - 1):
            for i in range(n):
                if i == (n - 1):
                    continue
                try1 = int(str(nums[i]) + str(nums[i + 1]))
                try2 = int(str(nums[i + 1]) + str(nums[i]))
                if try1 < try2:
                    tmp = nums[i]
                    nums[i] = nums[i + 1]
                    nums[i + 1] = tmp
        s = ""
        for c in nums:
            s += str(c)

        if int(s) == 0:
            return "0"

        return s