```
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums = sorted(nums)
l = len(nums)
left = 0
right = l
while (left < right):
mid = (left + right) / 2
if mid < nums[mid]:
right = mid
else:
left = mid + 1
return left
def missingNumber(self, nums):
n = len(nums)
return n*(n + 1)/2 - sum(nums)
```