""" 只出现一次的数字 """ from typing import List class Solution: def singleNumber(self, nums: List[int]) -> int: """ 异或运算 :param nums: :return: """ result = 0 for i in nums: result ^= i return result if __name__ == '__main__': root = Solution().singleNumber([2, 2, 1, 1, 3]) print(root)