Given a sorted array of size N, consisting of only 0’s and 1’s. The problem is to find the position of first ‘1’ in the sorted array Assuming 1 based indexing.
It could be possible that the array consists of only 0’s or only 1’s. If 1’s are not present in the array then print “-1”.
Input Format:
The first line contains an Integer 't' which denotes the number of test cases/queries to be run.
Then the test cases follow.
The first line of input for each test case/query contains an integer N representing the size of the array.
The second line of input for each test case/query contains N space-separated integers consisting of only ‘0’s and ‘1’s in the sorted order.
Output Format:
For each test case, print the position of the first ‘1’ in the sorted array. If 1’s are not present in the array then print “-1”.
Output for every test case will be printed in a separate line.
Note:
You do not need to print anything, it has already been taken care of. Just implement the function.
Constraints:
1 <= t <= 100
0 <= N <= 10^4
Time Limit: 1sec