Demo question. A real test gives you 2 or 3 problems on one clock, scored on hidden test cases, with no hints. This one is free and isn't scored.
Missing Number
EasyBit manipulationMathArrays~8 min
The array nums contains n distinct numbers taken from the range [0, n], so exactly one number from that range is missing. Return the missing number.
Try to use O(1) extra space.
Example 1
Input: nums = [3,0,1]
Output: 2
Example 2
Input: nums = [0,1]
Output: 2
Constraints
1 <= n == nums.length <= 10^50 <= nums[i] <= nAll values are distinct