Skip to content

Instantly share code, notes, and snippets.

@farsialgorithm
Created November 25, 2018 21:23
Show Gist options
  • Select an option

  • Save farsialgorithm/974a13a43973f5dd34ac1d75db6dd256 to your computer and use it in GitHub Desktop.

Select an option

Save farsialgorithm/974a13a43973f5dd34ac1d75db6dd256 to your computer and use it in GitHub Desktop.
def singleNumber(nums):
nums.sort()
i = 0
n = len(nums)
while i < n:
if i == n-1 or nums[i]!=nums[i+1]:
return nums[i]
i += 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment