Empty slot in list of integers
Question
You have a list of integers that range from values 1
to n
. Each value in the list is unique, however one random slot in the list is empty, making the size of the input array n-1
. Can you write a function to find the missing integer?
Examples:
Input: arr[] = [1, 2, 4, 6, 3, 7, 8]
Output: 5
Input: arr[] = [1, 3, 2, 5, 6]
Output: 4