每日一道Leetcode - 136. 只出现一次的数字【异或|位运算】
class Solution: def singleNumber(self, nums: List[int]) -> int: n = len(nums) # 使用异或 ans = nums[0] for i in range(1,n): ans ^= nums[i] return ans