You are given the following:
An integer N (N is always even)
A binary string S of length N * N (S has an equal number of 0's and 1's)
Find the minimum number of swaps required to meet both the below conditions.
1.) if ((i+1) mod N) - (i mod N )= 1, then S[i+1] + S[i] = 1 (0 <= i < N * N -1)
2.) if i + N < N * N, then S[i+N] + S[i] = 1
Sample Input:
2
0101
Sample output
1
Explaination : Swap the last 0 and 1 to make the string 0110. This string meets both the conditions.