Skip to content

Instantly share code, notes, and snippets.

@yesidays
Created April 1, 2020 18:11
Show Gist options
  • Save yesidays/6c29dc1fb129ed7051e37f151acfd6b2 to your computer and use it in GitHub Desktop.
Save yesidays/6c29dc1fb129ed7051e37f151acfd6b2 to your computer and use it in GitHub Desktop.
Leetcode - Single number solution
#https://leetcode.com/explore/challenge/card/30-day-leetcoding-challenge/528/week-1/3283/
class Solution:
def singleNumber(self, nums: List[int]) -> int:
nums.sort()
found = 0
for i in nums:
if nums.count(i) == 1:
found = i
return found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment