EQUAL MEX
/* 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
{
// your code goes here
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
HashMap<Integer,Integer> hm=new HashMap<>();
int x=2*n;
while(x-->0){
int p=sc.nextInt();
if(!hm.containsKey(p)){
hm.put(p,1);
}
else{
hm.put(p,hm.get(p)+1);
}
}
for(int i=0;i<=n;i++){
Integer freq=hm.get(i);
if(freq==null){
System.out.println("YES");
break;
}
else if(freq==1){
System.out.println("NO");
break;
}
else if(freq>=2){
continue;
}
}
}
}
}
Comments
Post a Comment