Help me in solving ZEROSTRING problem

My issue

i cant think of any test case that fails this please help me to rectify my mistake and also suggest how can i approach such problems effectively i am just a beginner and just started c programming and python few weeks ago

My code

#include <stdio.h>

int main(void) {
	// your code goes here
	int test;
	scanf("%d", &test);
	while(test--){
	    int size;
	    scanf("%d", &size);
	    char arr[size];
	    scanf("%s", arr);
	    int counter1=0,counter0=0;
	    for(int i=0;i<size;i++){
	        if(arr[i]=='0') counter0++;
	        if(arr[i]=='1') counter1++;
	    }
	    int min=counter0;
	    if(min>counter1) min=counter1;
	    if(counter0==size) printf("0\n");
	    else if(counter1==size) printf("1\n");
	    else if(counter0==counter1) printf("%d\n", counter1);
	    else if(counter1==1) printf("1\n");
	    else printf("%d\n", min+1);
	    
	}
	return 0;
}


Problem Link: ZEROSTRING Problem - CodeChef

@rohanbhat
for test case
1
5
10001
your output is
3
but correct output is
2

thank you so much ,now i got different way to solve the problem