← All problemsSign in

Printing Binary Array

CodeChefRating 1130Open on judge ↗

Consider a binary array $B = B_1, B_2, \ldots, B_M$ of length $M$. Being a binary array means that every $B_i$ is either $0$ or $1$. \ $Score(B)$ is defined as the number of indices $i$ $($where $1 \leq i < M)$ such that $B_i \neq B_{i+1}$. You are given a binary array $A = A_1, A_2, \ldots, A_N$ of length $N$. Print a binary array $C$ of length $N$ such that - $A \neq C$, and - $Score(A)=Score(

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start