Interesting Binary (Easy Version)
You are given an array $A$ of length $N$. Initially, each element of $A$ is either $0$ or $1$ (that is, $A_i \in \{0, 1\}$). In one operation, you may increase any element $A_i$ $(1 \le i \le N)$ by $1$, and you may perform such operations any number of times, including zero. Your goal is to make the array **adjacent-distinct**, i.e. $$ A_i \ne A_{i+1} \text{ for all } 1 \le i < N. $$ Find th
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