Missing Number

Easy · Bit Manipulation · about 10 minutes

Asked at Amazon, Microsoft, Meta.

An array nums contains n distinct numbers taken from the range [0, n]. Return the one number in the range that is missing. Use O(1) extra space.