← All problemsSign in

Equal Elements

CodeChefRating 1718Open on judge ↗

An array $B$ of size $2 \cdot M$ is called good if the following condition holds: - For each $i = 1, 2, \ldots, M$, $B_{2 \cdot i - 1} = B_{2 \cdot i}$. For example, $B = [1, 1, 3, 3]$ and $B = [4, 4]$ are good, but $B = [1, 1, 2]$ is not. --- You are given an array $A$ of length $N$. Find the length of longest subsequence of $A$ which is good. A subsequence is formed by deleting several ele

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