Colourful Balls
Kid Chef has a collection of $N$ balls arranged in a row on a table. They have numbers $1$ to $N$ written on them from left to right. The $i^{th}$ ball from the left has color $C_i$. Kid Chef wants to remove some subset of these balls (possibly empty) from the table. Note that the chosen subset is not necessarily contiguous. There will be $Q$ **independent** queries for this task. Each query 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.
Sign in to chat with the tutor and save your progress.
Sign in to start