Skip to content

Commit 87fdb7c

Browse files
Created ProblemDifficulties in java
Added a Codechef problem
1 parent f4e592d commit 87fdb7c

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

ProblemDifficulties.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import java.util.*;
2+
3+
public class ProblmeDifficulties {
4+
5+
public static void main(String[] args) {
6+
Scanner sc = new Scanner(System.in);
7+
int t = sc.nextInt();
8+
while(t-- > 0) {
9+
HashMap<Integer , Integer> hm = new HashMap<>();
10+
for(int i = 1 ; i <= 4 ; i++) {
11+
int x = sc.nextInt();
12+
hm.put(x , hm.getOrDefault(x, 0) + 1);
13+
}
14+
if(hm.size() == 4 || hm.size() == 3) {
15+
System.out.println("2");
16+
}else if(hm.size() == 1) {
17+
System.out.println("0");
18+
}else {
19+
for(Integer num : hm.values()) {
20+
if(num % 2 == 0) {
21+
System.out.println("2");
22+
}else {
23+
System.out.println("1");
24+
}
25+
break;
26+
}
27+
}
28+
}
29+
sc.close();
30+
}
31+
32+
}

0 commit comments

Comments
 (0)