| Topic | Difficulty | Companies |
|---|---|---|
| Hash Table | MEDIUM | Facebook Uber |
Given an array arr of size n, write a program to find the most frequent element in the array, i.e. the element which occurs the most number of times.
Problem Note
Example 1
Input: arr[] = [3, 9, 1, 3, 6, 3, 8, 1, 6]
Output: 3
Explanation: 3 appears three times in array which
is maximum frequency.
Example 2
Input: arr[] = [1, 15, 1, 9 , 2, 9, 10]
Output: 1
Explanation: 1 and 9 appears two times in array. Retrun 1 which is smallest.