Last updated
0001
0010
1010
0100
0001
0100
0011
0011func singleNumbers(_ nums: [Int]) -> [Int] {
var x = 0, y = 0, n = 0, t = 1
nums.forEach { n ^= $0 }
while (t & n) == 0 { t <<= 1 }
nums.forEach {
(($0 & t) >= 1) ? (x ^= $0) : (y ^= $0)
}
return [x, y]
}