mycode is giving TLE…sir how can i improve it…
package chall_Hashing_and_trees;
import java.util.*;
public class exist_or_not {
static Scanner s=new Scanner(System.in);
public static void main(String[] args) {
int t = s.nextInt();
for(int j=0 ; j<t ;j++) {
int len=s.nextInt();
int[] arr=new int[len];
for(int i=0 ;i<len ;i++) {
arr[i] =s.nextInt();
}
ArrayList list =new ArrayList<>();
for(int i = 0 ;i < len ;i++) {
list.add(arr[i]);
}
int testcase =s.nextInt();
int[] tc=new int[testcase];
for(int i = 0;i<testcase ;i++) {
tc[i] =s.nextInt();
}
for(int i = 0 ; i<testcase ;i++) {
int num = tc[i];
if(list.contains(num)) {
System.out.println(“Yes”);
}else {
System.out.println(“No”);
}
}
}
}
}