Company: Growth jockey_10oct
Difficulty: medium
Minimum Operations to Achieve MEX k Problem Description GrowthJockey's Data Engineering team is analysing sprints in which every feature task carries a tag ID. You are given an array a of length n , where each element is a tag ID between 0 and n . You are also given a target number k , the MEX the team wants the array to have. The MEX of an array is the smallest non-negative integer that is not present in it. For example, MEX([0, 2, 3]) = 1 , MEX([1, 4]) = 0 and MEX([0, 1, 2]) = 3 . In one operation, the team can reassign the tag of any one task: choose any index i and change a[i] to any value in the range [0, n] . Find the minimum number of operations needed so that the MEX of the array becomes exactly k . Complete the function solve with the following parameters: n : the number of elements in the array k : the required MEX a : the n tag IDs It returns one integer: the minimum number of operations so that MEX(a) = k . Input Format The first line contains an integer t , the number of t