将两个数组合并,并升序排列
2021-03-27 本文已影响0人
冰点雨
var arr1 = [1,2,3]
let arr2 = [1,3,4]
arrOrder(arr1, arr2)
func arrOrder(_ array1:Array<Int>,_ array2:Array<Int>) -> Array<Int> {
let arr = arr1 + arr2
let sort3 = arr.sorted(by: <)
Print(sort3)
return Array()
}
// [1, 1, 2, 3, 3, 4]