https://leetcode-cn.com/problems/single-number/
位运算,用到了异或
对于异或,需要记住的两大特性
0 异或任何数都是它本身
任何数异或它本身等于0
class Solution(object):def singleNumber(self, nums):""":type nums: List[int]:rtype: int""""""位运算,异或0 异或任何数都是它本身任何数异或它本身等于0"""ans = 0for i in nums:ans ^= ireturn ans
