R5-技巧篇
思路:使用哈希记录次数即可
class Solution:
def singleNumber(self, nums: List[int]) -> int:
dict=defaultdict(int)
for num in nums:
dict[num]+=1
for num in nums:
if dict[num]==1:
return num