from functools import reduce class Solution: def singleNumber(self, nums: List[int]) -> int: return reduce(lambda r, a: r ^ a, nums)