Skip to content

Instantly share code, notes, and snippets.

@chirag-shinde
Created April 2, 2020 05:30
Show Gist options
  • Save chirag-shinde/077a84115b365005ba31f2a5cd40bf07 to your computer and use it in GitHub Desktop.
Save chirag-shinde/077a84115b365005ba31f2a5cd40bf07 to your computer and use it in GitHub Desktop.
class Solution:
def singleNumber(self, nums: List[int]) -> int:
nums_set = set()
for num in nums:
if num in nums_set:
nums_set.remove(num)
else:
nums_set.add(num)
return nums_set.pop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment