-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauglunchI.cpp
44 lines (44 loc) · 857 Bytes
/
auglunchI.cpp
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
41
42
43
44
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define infinte 2147483647
#define fon(i,n) for(int i=0 ; i<n ; i++)
#define ui unsigned int
#define ll long long
#define ull unsigned long long
#define uos unordered_set
#define ump unordered_map
#define mp make_pair
using namespace std;
inline int max(int a,int b){ return (a>b)?a:b;}
inline int min(int a,int b){ return (a>b)?b:a;}
void solve(){
int n;cin>>n;
unordered_map<int,int> freq;
for(int i=0 ; i<n ; i++){
int x;cin>>x;
freq[x]++;
}
map<int,int> freq1;
for(auto x: freq){
freq1[x.second]++;
}
int maxVal=0;
for(auto x:freq1){
maxVal=max(x.second , maxVal);
}
for(auto x:freq1){
if(x.second==maxVal){
cout<<x.first<<'\n';
return;
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--) solve();
return 0;
}