LeetCode-Hot Topic 100: 136.只出现一次的数字--代码和注释
最编程
2024-04-16 16:54:42
...
func singleNumber(nums []int) int {
res := 0
for _, num := range nums{
res ^= num // 对数组中的所有数字进行异或运算
}
return res
}