304 North Cardinal St.
Dorchester Center, MA 02124

# Problem Difficulties CodeChef Solution – Queslers

## Problem: Problem Difficulties CodeChef Solution

You have prepared four problems. The difficulty levels of the problems are A1,A2,A3,A4A1,A2,A3,A4 respectively. A problem set comprises at least two problems and no two problems in a problem set should have the same difficulty level. A problem can belong to at most one problem set. Find the maximum number of problem sets you can create using the four problems.

### Input Format

• The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
• The first and only line of each test case contains four space-separated integers A1A1, A2A2, A3A3, A4A4, denoting the difficulty level of four problems.

### Output Format

For each test case, print a single line containing one integer – the maximum number of problem sets you can create using the four problems.

### Constraints

• 1≤T≤10001≤T≤1000
• 1≤A1,A2,A3,A4≤101≤A1,A2,A3,A4≤10

Subtask #1 (100 points): Original constraints

### Sample Input 1

``````3
1 4 3 2
4 5 5 5
2 2 2 2
``````

### Sample Output 1

``````2
1
0
``````

### Explanation

Test case 11: You can prepare the first problem set using the first two problems and the second problem set using the next two problems. So the problem sets will be [1,4][1,4] and [3,2][3,2].

Test case 22: You can prepare one problem set using one problem having a difficulty level of 44 and the other having a difficulty level of 55. There is no way to prepare more than one problem set.

Test case 33: There is no way to prepare a problem set.

## Problem Difficulties CodeChef Solution Using C++

``````#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t--)
{
int n=4;
int a[n];
for (int i = 0; i < n; i++) {
cin>>a[i];

}
sort(a,a+n);
if(a[0]==a[1] && a[1]==a[2] && a[2]==a[3])
cout<<"0"<<endl;
else if(a[0]!=a[1] && a[1]!=a[2] && a[2]!=a[3])
cout<<"2"<<endl;
else if(a[0]==a[1] && a[1]==a[2])
cout<<"1"<<endl;
else if(a[1]==a[2] && a[2]==a[3])
cout<<"1"<<endl;
else
cout<<"2"<<endl;
}
return 0;
}
``````

## Problem Difficulties CodeChef Solution Using Python

``````t = int(input())
for _ in range(t):
inputt = [int(i) for i in input().split()]
inputt.sort()
if(inputt[0]==inputt[1] and inputt[2]==inputt[3] and inputt[0]!=inputt[3]):
print(2)
continue
inputt = set(inputt)
if len(inputt) == 4 or len(inputt) == 3:
print(2)
continue
if len(inputt) ==2:
print(1)
else:
print(0)
``````
##### Problem Difficulties CodeChef Solution Review:

In our experience, we suggest you solve this Problem Difficulties CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Problem Difficulties Problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get Problem Difficulties CodeChef Solution.

##### Conclusion:

I hope this Problem Difficulties CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More on Queslers >>

CodeChef Solution