Easy · Binary Search

Missing Number

Given an array nums of n distinct numbers taken from the range 0 to n, return the only number in that range that is missing from the array.

Examples

Example 1

[3,0,1]

Output: missing 2

Example 2

[0,1]

Output: missing 2

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Binary Search problems