forked from deepanshumishra/JavaAndCPP_programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEQDIS.java
More file actions
40 lines (33 loc) · 740 Bytes
/
Copy pathEQDIS.java
File metadata and controls
40 lines (33 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package codechef_lib;
import java.util.HashSet;
import java.util.Scanner;
public class EQDIS {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int cases=sc.nextInt();
while(cases--!=0) {
int n = sc.nextInt();
int cnt_ex=0;
HashSet<Integer> set = new HashSet<>();
int arr[] = new int[n];
for(int i=0;i<n;i++) {
arr[i]=sc.nextInt();
if(set.contains(arr[i])) {
cnt_ex++;
}
set.add(arr[i]);
}
if(set.size()%2==0) {
System.out.println("YES");
}else {
if(cnt_ex>0) {
System.out.println("YES");
}else {
System.out.println("NO");
}
}
}
}
}
//AC