Company: NextWave
Difficulty: medium
The MEX Number of a non-negative set of numbers is the smallest non-negative number that is not present in the set. For example, MEX({2, 4, 11}) = 0, and MEX({0, 2, 3, 9}) = 1. Your task is to take a given array A of length I and remove the minimum number of elements from it so that the MEX value of the modified array is not equal to the MEX value of the original array. Your code should return the minimum number of elements that need to be removed from the array. If the task is not possible, then your code should return -2 . Input: First line contains an integer I , representing the size of the array A . Second line contains elements of the array A , separated by space. Output: The output consists of an integer. Constraints: Array A elements are non-negative integers. Array elements are not necessarily distinct. 1 <= I <= 100 0 <= A[i] <= 90 Explanation