Help me in solving DOMINANT2 problem

My issue

can you give hint how to find dominant element in array

My code

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

int main() {
	int t,A[n];
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    for(int i=0;i<n;i++)
	    {
	        cin>>A[i];
	    }
	}
	
}

Problem Link: Dominant Element Practice Coding Problem

@nischay_shukla
here plzz refer the following code

#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];
	    map<int,int> mp;
	    int mx=0;
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	        mp[a[i]]++;
	        mx=max(mx,mp[a[i]]);
	    }
	    int cnt=0;
	    for(auto x:mp)
	    {
	        if(x.second==mx)
	        cnt++;
	    }
	    if(cnt==1)
	    cout<<"YES";
	    else
	    cout<<"NO";
	    cout<<endl;
	}

}