go + 异或运算
规律:
a ^ a = 0
a ^ 0 = a
func solve( a []int ) int { // write code here miss := 0 // 异或运算 for i, x := range a { miss ^= (i+1) ^ x } return miss }
go + 异或运算
规律:
a ^ a = 0
a ^ 0 = a
func solve( a []int ) int { // write code here miss := 0 // 异或运算 for i, x := range a { miss ^= (i+1) ^ x } return miss }