CodeChef::MODEFREQ(incomplete)

 

#include <iostream>
using namespace std ;

int main(){
int T ;
cin >> T ;
while (T --){
int N ;
cin >> N ;
int A[N];
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
int temp[N];
for (int i = 0; i < N; ++i) {
temp[i] = 0 ;
}
int count{0} ;
for (int i = 0; i < N; ++i) {
if (temp[i] == 0){
for (int j = i; j < N; ++j) {
if (A[j] == A[i]){
count = count + 1 ;
temp[j] = 1 ;
}

}
cout << count << '\n';
count = 0 ;

}

}


}
return 0 ;
}

Comments

Popular posts from this blog

CodeChef::CSUB

How Recursion Works?

CodeChef::TREE2