Binary Strings
CodeChefOpen on judge ↗
Problem description In a meeting Monti is given a binary string of N characters. A binary string is string consisting of only 0's and 1's. Monti can swap any adjacent pair of characters in one operation. Monti has to bring at least M 1's together starting at any position of the string. Help him count the minimum number of operations required to do so. It is guaranteed that there are at least M 1
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