C++ Visible Numbers
Easy Accuracy: 21.68% Submissions: 3405 Points: 2

Given an array of integer having n elements, print the numbers that occur more than n/3 in that array. 

Input: 
The first line of input contains integer T denoting the number of test cases.  Each test case has subsequent two lines of input. The first line is an integer N, denoting the size of integer array A. Second line consists of
N space separated integers of the array A.

Output:
For each test case, the output is the elements that occur more than n/3 times in increasing order. If no element occurs then return -1.

Constraints:
1<=T<=100
1<=N<=100
0<=A[i]<=100

Example:
Input:
2
6
1 2 1 3 1 2

8
1 2 2 3 2 3 2 3
Output:
1
2 3

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.