Unmedian
You are given an array $A$ of length $N$. You can perform the following operation on it: - Choose any contiguous subarray of $A$ such that its length is **greater than $1$** and **odd**. - Then, delete the median$^\dagger$ of this subarray from it. If there are multiple occurrences of the median within the subarray, delete the **leftmost** one. Note that the length of the array decreases by $1
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