Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.
Input: nums = [3,0,1]
Output: 2
Topics: arrays, bit-manipulation
Asked by: Microsoft, Amazon
Time complexity: O(n). Space complexity: O(1).