My issue
What was problem say?
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0;i<n;i++){
}
}
}
Learning course: Arrays, Strings & Sorting
Problem Link: Equal Elements Practice Problem in - CodeChef
@sanjanalcse202
plzz refer the following solution
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
// your code goes here
int t,i;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
int count=1;
sort(a,a+n);
int ans=0;
for(i=1;i<n;i++){
if(a[i]==a[i-1])
{
count++;
}
else
{
ans=max(ans,count);
count=1;
}
}
ans=max(ans,count);
cout<<n-ans<<endl;
}
return 0;
}