#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
map<int,int,greater> mp;
for(int i=0;i<n;i++)
{
cin>> a[i];
mp[a[i]]++;
}
multimap<int,int,greater > mpp;
for(auto it=mp.begin();it!=mp.end();it++)
{
mpp.insert(make_pair(it->second,it->first));
}
for(auto it=mpp.begin();it!=mpp.end();it++)
{
cout<second<<endl;
break;
}
}
Code getting error
but it works on some other compiler
@abhijeet.srivastava6499 i am getting TLE for 2 of the test cases .
I used hasing but still i getting TLE.
Is there any more efficient solution does exist?
Please reply fast
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.