At Stripe, a service emits every integer from 0 to n exactly once, but one value is missing from the final array. Given an array nums containing n distinct integers in the range [0, n], return the missing number.
nums[0, n]len(nums) = nnums are distinct[0, n]Example 1
nums = [3, 0, 1]20, 1, 2, 3, so 2 is missing.Example 2
nums = [0, 1]20, 1, 2, and 2 does not appear.Example 3
nums = [9, 6, 4, 2, 3, 5, 7, 0, 1]80 to 9 appears except 8.1 <= len(nums) <= 10^50 <= nums[i] <= len(nums)nums are unique[0, n] is missingnums = [3, 0, 1]Output2WhyThe full range is `0` through `3`. The value `2` is the only missing number.nums = [0, 1]Output2WhyThe expected values are `0, 1, 2`. Since `0` and `1` are present, the missing value is `2`.nums = [1]Output0WhyFor `n = 1`, the full range is `0, 1`. Since only `1` is present, `0` is missing.1 <= len(nums) <= 10^50 <= nums[i] <= len(nums)All values in nums are distinctExactly one number in the range [0, n] is missingdef missing_number(nums):