 All Problems
Missing Number
easy
arrays
math
bit manipulation
amazon
microsoft
google
bloomberg

Given an array nums containing n distinct numbers in the range [0, n], return the one number that is missing.

Example 1:

Input:  3 0 1
Output: 2

Example 2:

Input:  0 1
Output: 2

Constraints: O(1) extra space, O(n) time.

Input format: Space-separated integers.

Run to check your code against the sample cases, or submit to run every case