← All problemsSign in

Remove Two

You are given an array $A$ of size $N$, where $N$ is odd. In one operation, you can remove two elements $A_{i}$ and $A_{j}$ $(i \neq j)$ from the array, if there exists other element $A_{k}$, such that $k \neq i$, $k \neq j$ and $A_{i} \leq A_{k} \leq A_{j}$. You can perform any number of operations on $A$. Your aim is to remove some elements (possibly none) from the array such that all elements i

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