Smallest missing number in array

Question

Write a function that outputs the smallest missing number in a sorted array of n unique integers. The integers in the array range from 0 to m-1, where m > n.

The function should be called 0SmallestMissingNumber` and the 3 inputs are:

  • the array
  • the "start value" of the array
  • the length of the array - 1

For example:

 #Input: 
 [0, 1, 3, 4, 8, 9], n = 5, m = 10
 #Output: 
 2

 #Input: 
 [4, 7, 9, 11], n = 4, m = 12
 #Output: 
 0

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now