← All problemsSign in

Equal Subsequences

CodeChefRating 2734Open on judge ↗

Chef has a sequence $A$ of $2 \cdot N$ integers containing all natural numbers from $1$ to $N$ **exactly twice**. Let a sequence $B$ containing $K$ elements be a [subsequence](https://en.wikipedia.org/wiki/Subsequence) of $A$. We define a **strictly increasing** *index* sequence $I(B) = [I_1, I_2, \ldots, I_K]$ such that, $B$ can be written as $[A_{I_1}, A_{I_2}, \ldots, A_{I_K}]$. A pair of 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