1
2
3
4
5
6
7
8
9
10
11
12
| // @Title: 只出现一次的数字 (只出现一次的数字 )
// @Author: 15816537946@163.com
// @Date: 2022-03-16 21:23:46
// @Runtime: 4 ms
// @Memory: 3.2 MB
func singleNumber(nums []int) int {
a,b :=0, 0
for _, num := range nums {
a, b = b&^a&num|a&^b&^num, (b^num)&^a
}
return b
}
|