My issue
What’s the problem in the code. My approach was to maintain the frequency from1 to 10 as zero and increase the frequency as per the repetition of the number.and at the end n-maximum of frequency.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int T;cin>>T;
while(T--){
int N;cin>>N;
int arr[N];
for(int i=0;i<N;i++){
cin>>arr[i];
}
int brr[10]={0};
for(int i=0;i<N;i++){
brr[arr[i]]++;
}
int maximum=INT_MIN;
for(int i=0;i<10;i++){
maximum=max(maximum,brr[i]);
}
cout<<N-maximum<<endl;
}
}
Problem Link: Card Removal Practice Coding Problem - CodeChef