C++ Visible Numbers
Submissions: 2683   Accuracy:

21.83%

  Difficulty: Easy   Marks: 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

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Vanshika
Author: Vanshika_pec


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.