← All problemsSign in

Similar Subsequence

CodeChefRating 2689Open on judge ↗

Chef is given an array $A$ of length $N$. He considers a subarray $[L, R]$ to be *good* if and only if there exists a subsequence $[i_1, i_2, \ldots, i_{R-L+1} ]$ such that: - $A_{i_k} = A_{L+k-1}$ for each $1 \leq k \leq R-L+1$ (i.e. the subsequence is same as the subarray element-wise) - For **at least one** value of $k$, $i_k \neq L+k-1$ (i.e. the subsequence differs from the subarray index-wi

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