← All problemsSign in

MEX Sequences

CodeChefRating 2838Open on judge ↗

Chef is learning about **absolute** [MEX](https://en.wikipedia.org/wiki/Mex_(mathematics)) sequences. A sequence $A$ of $N$ integers is said to be an **absolute** MEX sequence, if the following property holds for all $1\le i \le N$: - $|A_i - \texttt{MEX} (A_1, A_2, \dots, A_i)| \leq 1$ Chef has two integers $N$ and $M$. Find the total number of **absolute** MEX sequences $A$, of length $N$, 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