Empty slot in list of integers


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?

Input: arr[] = [1, 2, 4, 6, 3, 7, 8]
Output: 5

Input: arr[] = [1, 3, 2, 5, 6]
Output: 4


Access restricted

Subscribe to premium account to see the solution.

Get premium now