def singleNumber(self, nums):
:type nums: List[int]
for element in nums: if element in dict: dict[element] += 1 else: dict[element] = 1 for key in dict.keys(): if dict[key] == 1: return key
#Linear Time But uses extra-space
return reduce (lambda x,y: x^y, A)
tried once, 52 ms. Some one got 40ms, would like to see the code.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.