Skip to content

Instantly share code, notes, and snippets.

@cixuuz
Created October 23, 2017 18:01
Show Gist options
  • Save cixuuz/4a97012d98294f83a4681da094142f81 to your computer and use it in GitHub Desktop.
Save cixuuz/4a97012d98294f83a4681da094142f81 to your computer and use it in GitHub Desktop.
[268. Missing Number] #leetcode
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
return n * (n+1) / 2 - sum(nums)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment