Minimum Cost to Segregate Binary String

Given a binary string s consisting only of '0' and '1'.

Move '1' characters to the right so that all '0' characters appear before all '1' characters, resulting in:

000...0111...1...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: