Advertisement
Guest User

136. Single Number

a guest
Feb 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. class Solution(object):
  2.     def singleNumber(self, nums):
  3.         s = set()
  4.         for num in nums:
  5.             if num in s:
  6.                 s.remove(num)
  7.             else:
  8.                 s.add(num)
  9.         return s.pop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement