Possible MEX Values After At Most One Increment

Given an integer array memoryBlocks of length n, where:

  • 0 ≤ memoryBlocks[i] < n
  • You may perform at most one operation: choose an element satisfying memoryBlocks[i] < n - 1 and increas...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: