Swift Solution easiest


#1
func largestNumber(_ A: [Int]) -> String {

var newArray = A

newArray.sort { X, Y in
    let XY = "\(X)" + "\(Y)"
    let YX = "\(Y)" + "\(X)"
    
    return XY > YX
}

 if ((newArray[0] == 0) && (newArray.count > 1)) {
    return "0"
}

let res = ""
let answerString = newArray.reduce(into: res,  { result, num in
    result = result + "\(num)"
})

return answerString

}