137 Single Number II
class Solution:
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
hash_count = {}
for key in nums:
if key in hash_count:
hash_count[key] += 1
else:
hash_count[key] = 1
for key, val in hash_count.items():
if val == 1:
return key
obj = Solution()
print(obj.singleNumber([1]))Last updated