Find mode
Practice
3.4 (11 votes)
Basic programming
Easy
Open
Approved
Hash table
Problem
56% Success 7362 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Write a program to find the mode of a given list of integers. Mode of a number is defined as the number which is most frequently occured.
For example:
L = {1,2,2,3} // Here mode is 2(most frequently occured)

It is possible that multiple answers are possible for a list. In that case print all possible answers in non-increasing order.

Input:
First Line of input contains an integer t represeting the number of test cases, Where first line of each test case has an integers N - number of integers in list, Next line contains N integers.

Output:
print all the possible modes in non-increasing order.

Constraints:
1<=t<=100
1<=N<100000
1<=a[i]<=1000000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
9 votes
Tags:
OpenApprovedHashingEasy
Points:20
18 votes
Tags:
Hash tableData StructuresEasyOpenApprovedHash function
Points:20
111 votes
Tags:
MapSortingEasyHash tableData Structures