Find Missing Number in Sequence

Languages

Given an array numbers of size n storing n different integers which fall within the range [0, n], implement a function to identify the missing element in the array. All numbers except one are present in the array. Find the missing number.

Input

  • numbers: number[]: An array of integers

Examples

Input: numbers = [1,3,0]
Output: 2
Explanation: The array has a size of 3, and within the range from 0 to 3, the number 2 is missing from the array
Input: numbers = [1]
Output: 0
Explanation: The array has a size of 1, and within the range from 0 to 1, the number 0 is missing from the array
Input: numbers = [3,0,4,2,1]
Output: 5
Explanation: The array has a size of 5, and within the range from 0 to 5, the number 5 is missing from the array

Constraints

  • 1 <= n <= 10,000
  • 0 <= numbers[i] <= n