1 class Solution:
 2     def singleNumber(self, nums: 'List[int]') -> int:
 3         dic = {}
 4         for n in nums:
 5             if n not in dic:
 6                 dic[n] = 1
 7             else:
 8                 dic[n] += 1
 9         for k,v in dic.items():
10             if v == 1:
11                 return k

 

posted on 2019-12-11 13:59  Sempron2800+  阅读(123)  评论(0编辑  收藏  举报