Advertisement
Guest User

Untitled

a guest
Nov 16th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. class Solution:
  2. def singleNumber(self, nums: List[int]) -> List[int]:
  3. dic = {}
  4. for x in nums:
  5. if x in dic:
  6. dic[x] += 1
  7. else:
  8. dic[x] = 1
  9. ans = []
  10. for key,val in dic.items():
  11. if val == 1:
  12. ans.append(key)
  13.  
  14. return ans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement