← All problemsSign in

Subset MEX Counting

CodeChefRating 1879Open on judge ↗

For a given integer array $A$ of length $N$, and satisfying $0 \le A_i < N$, and another integer parameter $M$ ($1 \le M \le N$), define $f(A, M)$ in the following way: - Start with an empty set $S = \{\}$. - For each $M$ length subsequence of $A$, i.e. all sequences of the form $[A_{i_1}, A_{i_2}, \ldots, A_{i_M}]$ with $1 \le i_1 < i_2 < \ldots < i_M \le N$, insert the MEX$^{\dagger}$ of the su

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