Created
April 2, 2020 05:30
-
-
Save chirag-shinde/077a84115b365005ba31f2a5cd40bf07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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