1,420
社区成员
发帖
与我相关
我的任务
分享
func sort(array : [Int], compareFunc:(Int,Int) -> Bool) -> [Int] {
var sortedArray = array
for i in 0..<sortedArray.count {
for j in i..<sortedArray.count {
if compareFunc(sortedArray[i], sortedArray[j]) {
let temp = sortedArray[i]
sortedArray[i] = sortedArray[j]
sortedArray[j] = temp
}
}
}
return sortedArray
}