← All problemsSign in

Good Binary Strings

CodeChefRating 1573Open on judge ↗

You are given a binary string $S$. A binary string is a string consisting of only $0$'s and $1$'s. A binary string is called *good* if it has an equal number of occurrences of $\texttt{01}$ substrings and $\texttt{10}$ substrings. Note that these substrings may overlap. For example, the string $1101001$ is *good* since there are two occurrences of $\texttt{01}$ ($11\underline{01}001$ and $11010\u

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