SP19142 INS14A - BSTRING
Description
In his next interview digo is given a binary string of N characters. A binary string is string consisting of only 0's and 1's. Digo can swap any adjacent pair of characters in one operation. Digo has to bring atleast 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 gauranteed that there are atleast M 1's present in the given string.
Input Format:
First line contains single integer T. Number of test cases.
Next 2 \* T lines represent T test cases. Each test case is described by two lines; first line contains a single integer M and the second line contains the input binary string.
Output Format:
Output T lines, one for each test case containing the answer for that case.
Constraints :
1
Input Format
N/A
Output Format
N/A