Count binary string

why it give wrong answer?? only few test cases pased
import java.util.*;
public class Main {
public static void main(String args[]) {

Scanner kb=new Scanner(System.in);
int t=kb.nextInt();

 while(t-->0)
    {
	int n=kb.nextInt();

	int []zeroes=new int[n];
	int []ones=new int[n];

	zeroes[0]=1;
	ones[0]=1;

	for(int i=1;i<n;i++)
	   {
       zeroes[i]=zeroes[i-1] + ones[i-1];
	   ones[i]=zeroes[i-1];	
	   }	
	  
	  System.out.println(zeroes[n-1]+ones[n-1]);
	}

}

}

@abhishekg,

int []zeroes=new int[n];
int []ones=new int[n];

In the above arrays use long instead of int.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.