class Solution:
    def singleNumber(self, nums: List[int]) -> int:
        return functools.reduce(lambda acc, v: acc ^ v, nums)

Complexity

Time:
Space: — But in this functional approach