Golang | Leetcode Golang题解之第137题只出现一次的数字II
题目:
题解:
func singleNumber(nums []int) int {
a, b := 0, 0
for _, num := range nums {
b = (b ^ num) &^ a
a = (a ^ num) &^ b
}
return b
}
题目:
题解:
func singleNumber(nums []int) int {
a, b := 0, 0
for _, num := range nums {
b = (b ^ num) &^ a
a = (a ^ num) &^ b
}
return b
}