Created
October 23, 2017 18:01
-
-
Save cixuuz/4a97012d98294f83a4681da094142f81 to your computer and use it in GitHub Desktop.
[268. Missing Number] #leetcode
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(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