Good Subsequence
A sequence $B$ is called good if $B_i \mod 2 \ne B_{i - 1} \mod 2$ for all $2 \le i \le |B|$. For example, $[1, 2, 3]$ and $[4]$ are good sequences, but $[1, 3]$ is not. You are given an array $A$ of length $N$. Find the length of the largest subsequence$^{\dagger}$ of $A$ that is good. --- $^{\dagger}$ A subsequence is a sequence that can be formed by deleting some (possibly zero) elements fr
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.
Sign in to chat with the tutor and save your progress.
Sign in to start