← All problemsSign in

MEXtreme Divisibility

CodeChefRating 2884Open on judge ↗

The *div-MEX* of an array is defined to be the smallest positive integer that doesn't divide *any* element of the array. For example, the *div-MEX* of $[4, 10, 1, 9, 21]$ is $6$, because every integer from $1$ to $5$ divides at least one element of the array, but $6$ doesn't divide any of them. You're given an array $A$ of length $N$, and an integer $M$. The elements of $A$ all lie between $1$

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start