ALG-E016EasyMath
Missing Sequence Identifier
numbers contains every integer from 0 through n except exactly one, where n is the array length. Return the missing integer.
Contract
input numbers: integer[]
return integer
Constraints
- • All values are distinct
- • 0 <= n <= 100000
Examples
Example 1
numbers = [3, 0, 1]
→ 2
Example 2
numbers = [0, 1]
→ 2
5 judge tests (2 shown above). Target complexity: O(n).