Binary String Codeforces Solution | Codeforces Problem Solution 2022
You are given a string consisting of characters 0 and/or 1.
You have to remove several (possibly zero) characters from the beginning of the string, and then several (possibly zero) characters from the end of the string. The string may become empty after the removals. The cost of the removal is the maximum of the following two values:
- the number of characters 0 left in the string;
- the number of characters 1 removed from the string.
What is the minimum cost of removal you can achieve?
The first line contains one integer () — the number of test cases.
Each test case consists of one line containing the string (), consisting of characters 0 and/or 1.
The total length of strings in all test cases does not exceed .
For each test case, print one integer — the minimum cost of removal you can achieve.
Join Now for Solution:-
No comments:
Post a Comment