Near Yet Far
*This is the easy version of the problem. You only need to compute the score for the given array.* You are given an array $A$ of length $N$, as well as an integer $K$ ($2 \le K \le N$). A sequence of indices $(i_1, i_2, \ldots, i_r)$ is said to be *valid* if: - $i_1 \lt i_2 \lt \ldots \lt i_r$ - That is, the indices are viewed in increasing order. - $i_j + 1 \ne i_{j+1}$ for every $1 \le j
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