We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f4e592d commit 87fdb7cCopy full SHA for 87fdb7c
1 file changed
ProblemDifficulties.java
@@ -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
22
23
+ System.out.println("1");
24
25
+ break;
26
27
28
29
+ sc.close();
30
31
32
+}
0 commit comments