Coloured Array
An array $A$ consisting of $2 \cdot N$ elements is said to be **good** if it satisfies the following properties: - $1 \le A_i \le N$ for all $1 \le i \le 2 \cdot N$ - $A_{2 \cdot i - 1} = A_{2 \cdot i}$ for all $1 \le i \le N$. - $A_{2 \cdot i} \ne A_{2 \cdot j}$ for all $1 \le i < j \le N$. For example, some good arrays are $[2, 2, 1, 1]$ and $[2, 2, 1, 1, 3, 3]$. You are given an array $A$ wh
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