← All problemsSign in

Minimize the Bits

CodeChefRating 2594Open on judge ↗

You are given a **binary** string $A$ of length $N$. The [decimal representation](https://en.wikipedia.org/wiki/Binary_number#Binary_counting) of this string could be huge. Your task is to find out two binary strings $B$ and $C$, each of length $N$, such that: - $(A)_{10} = (B)_{10} - (C)_{10}$; - The total count of $1$s in $B$ and $C$ is **minimum**. If multiple such strings $B$ and $C$ e

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