Official algorithmic problem description and constraints.
You are given a binary string. Please find the minimum number of pieces you need to cut it into, so that the resulting pieces can be rearranged into a sorted binary string.

Note that:
A binary string is a string consisting of characters πΆ and π·. A sorted binary string is a binary string such that all characters πΆ come before all characters π·.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.