Please help me in DOMINANT2 problem

The problem name is ‘Dominant Element’. I did not understand the vector function in the problem. Please anyone explain that part.

include <bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[n];
for(int i=1;i<=n;i++){
cin>>a[i];
}
vector count(n+1,0);
for(int i=1;i<=n;i++){
count[a[i]]++;
}
sort(count.begin(),count.end());
if(count[n]!=count[n-1])
cout<<“yes”<<endl;
else
cout<<“no”<<endl;
}
return 0;
}

@infinic
vector is used to store the frequency of each number of the array.
like for array[1,1,2,2,2,3,3,3,3];
the vector will look like [0,2,3,4] cozz the frequency of 0 is 0 , the frequency of 1 is 2 and so on…