Dazzling Even-Odd Challenge
Dazzler has an interesting task for you. You will be given an array $A$ of $N$ positive integers such that: - $N$ is always **even**. - Exactly $\frac{N}{2}$ elements in the array are **even** and $\frac{N}{2}$ elements are **odd**. In one operation, you should do the following steps: - Choose two different indices $i$ and $j$ $(1 \le i,j \le N)$. - Set $A_i := A_i + 1$. - Set $A_j := A_j - 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