Company: Tower research_5sep
Difficulty: medium
Memory MEX Problem Description There are n memory blocks, and the size of the i -th block is memoryBlocks[i] , for 0 <= i < n . The following operation can be performed on memoryBlocks at most once : Select an index x . Increase memoryBlocks[x] by 1 . This is allowed only if memoryBlocks[x] < n - 1 ; an index whose block already has size n - 1 cannot be selected. (inferred -- the source says the operation can be performed one time, and also speaks of the array "after any number of operations". The two are reconciled as zero or one operation: you may skip the operation, or perform it exactly once on one index.) After you either skip the operation or perform it once, the smallest non-negative integer that is not present in memoryBlocks is called a Valid Size (the MEX, or minimum excluded value, of the array). Different choices can produce different Valid Sizes. Find every Valid Size that can be achieved, in ascending order, with no repeats. Complete the function findValidSizes(m