# MODEFREQ Unofficial Video Editorial In Hindi

Solution-

``````using namespace std;

int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n;
scanf("%d", &n);
int arr[11] = {0};

for (int i = 0; i < n; i++)
{
int num;
scanf("%d", &num);

arr[num]++;
}
int largeMod = 0;
int arr1[n + 1] = {0};
int large = 0;

for (int i = 0; i < 11; i++)
{
if (arr[i] != 0)
{

arr1[arr[i]]++;
}
}

int freq = 0;
for (int i = 0; i < n + 1; i++)
{

if (arr1[i] != 0)
{
if (arr1[i] > largeMod)
{
largeMod = arr1[i];
freq = i;
}
else if (arr1[i] == largeMod)
{

if (i < freq)
freq = i;
}
}
}

printf("%d\n", freq);
}
return 0;
}
``````

Why My code is not Accepted by the judge
/*
Author-> Codie_1(Akash)
*/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(n) for(int i=0;i<n;i++)
#define repi(n) for(int i=0;i<n;i++)
#define repj(n) for(int j=0;j<n;j++)
#define repp(n) for(int i=0;i<=n;i++)
#define repab(a,b) for(int i=a;i<b;i++)
#define w(t) int t; cin>>t; while(tâ)
#define endl â\nâ
#define mod 1e9 + 7
#define pi pair<int, int> p
#define pis pair<int, string> p
#define ff first
#define ss second
#define int64 long long int
#define pb push_back
#define mk make_pair
#define vi vector v
#define vl vector v;
bool cmp(int a, int b) {return a > b;}
#define MOD 1000000007

``````int main()
{
fast
w(t)
{
int n; cin >> n;
map<int, int> mp, mmp;
int arr[n] = {};
rep(n)
{
cin >> arr[i];
mp[arr[i]]++;
}
for (auto x : mp)
{
mmp[x.ss]++;
}
int maxi = -1;
int freq = INT_MAX;
for (auto x : mmp)
{
if (maxi < x.ss )
{
maxi = x.ss;
freq = x.ff;
}
}
// cout << freq << endl;
for (auto x : mp)
{
if (x.ss == freq)
{
cout << x.ff << endl;
break;
}
}

}

return 0;
}``````