题解 | #明明的随机数#
明明的随机数
https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
import Foundation var count = 0 var set: Set<Int> = [] while let line = readLine() { if line.isEmpty { break } if (count == 0) { count = Int(line) ?? 0 }else { set.insert(Int(line) ?? 0) } } var arr = Array(set).sorted(by: <) arr.map{ x in print(x) }#排序算法##去重#