Split The String
For a binary string $A$, let $f(A)$ denote its *badness*, defined to be the difference between the number of zeros and number of ones present in it. That is, if the string has $c_0$ zeros and $c_1$ ones, its badness is $|c_0 - c_1|$. For example, the badness of "$01$" is $|1 - 1| = 0$, the badness of "$100$" is $|2 - 1| = 1$, the badness of "$1101$" is $|1 - 3| = 2$, and the badness of the empty s
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