Given an array of integer having n elements, print the numbers that occur more than n/3 in that array.
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.
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.
1 2 1 3 1 2
1 2 2 3 2 3 2 3
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.