Given an array of n integers containing only 0 and 1. Write a program to find the minimum toggles (switch from 0 to 1 or vice-versa) required such the array the array become partitioned, i.e., it has first 0s then 1s. There should be at least one 0 in the beginning, and there can be zero or more 1s in the end.
First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a single integer N which denotes the number of element in the array. Second line of each test case contains N space separated integers(0 or 1).
For each test case, print the minimum toggles (switch from 0 to 1 or vice-versa) required such the array the array become partitioned.
1 <= T <= 100
1 <= N <= 105
1 <= A <= 100
1 0 1 1 0
0 1 0 0 1 1 1
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.