← All problemsSign in

Binary String Happiness

CodeChefRating 2735Open on judge ↗

For a binary string $S$, define its **beauty** to be the maximum number of [substrings](https://en.wikipedia.org/wiki/Substring) $S$ can be partitioned into, such that each substring has strictly more ones than zeroes. For example, the beauty of $11011$ is $3$, as it can be partitioned as $[110][1][1]$. If such a partition doesn't exist, the beauty is defined to be $0$. Also, define the **happin

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