题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import Foundation while let line = readLine() { var res = 0 var number = Int(line)! //! 需要过滤相同元素 var hash = Set<Int>() while number != 0 { let temp = number % 10 if hash.insert(temp).inserted { res = res * 10 res += temp } number = number / 10 } print(res) }