My issue
how to solve array out of bounds
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{ Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0;i<t;i++){
int n = sc.nextInt();
int p =0;
int a[]= new int[50];
int b[] = new int[50];
for( int k=0;k<n-1;k++)
{
if(a[k]<2*b[k] || b[k]<2*a[k]){
p+=1;
System.out.println(n-p);
}
}
}
}
}
Learning course: Arrays using Java
Problem Link: CodeChef: Practical coding for everyone