Given an array nums containing n distinct numbers in the range [0, n], return the one number in the range that is missing from the array.
Use XOR bit manipulation to solve this in O(n) time and O(1) extra space.
For example, given nums = [3, 0, 1], the range is [0, 3] and the missing number is 2.
nums = [3, 0, 1]2nums = [0, 1]2nums = [9, 6, 4, 2, 3, 5, 7, 0, 1]8n == nums.length1 <= n <= 10^40 <= nums[i] <= nAll values in nums are distinctRun your code to see results
Use Cmd+Enter to run