```
def missingNumber(nums):
return reduce(lambda x, y: x ^ y, nums) ^ reduce(lambda x, y: x ^ y, range(len(nums)+1))
```

The basic idea is to use bit manipulation. Imagine that there is a big list equals to nums + [n for n in xrange(len(nums) + 1)], we can xor all the items in the big list, those items that appear twice will xor themselves and turns into zero, therefor the result will be the number that we are seeking.