题中为LeetCode, 136题找到沒有反复2次的数据
class Solution(object): def singleNumber(self, nums): sum=0 for i in nums: sum=sum^i return sum d = Solution()g = d.singleNumber([4,1,2,1,2])print(g)
题中为LeetCode, 136题找到沒有反复2次的数据
class Solution(object): def singleNumber(self, nums): sum=0 for i in nums: sum=sum^i return sum d = Solution()g = d.singleNumber([4,1,2,1,2])print(g)