跳转至

LC136 - 只出现一次的数字

SingleNumber.go
1
2
3
4
5
6
7
8
9
package Other

func singleNumber(nums []int) int {
    eor := 0
    for _, num := range nums {
        eor ^= num
    }
    return eor
}

异或和