题目:
题解:
func largestNumber(nums []int) string {sort.Slice(nums, func(i, j int) bool {x, y := nums[i], nums[j]sx, sy := 10, 10for sx <= x {sx *= 10}for sy <= y {sy *= 10}return sy*x+y > sx*y+x})if nums[0] == 0 {return "0"}ans := []byte{}for _, x := range nums {ans = append(ans, strconv.Itoa(x)...)}return string(ans)
}