- 0of 0 votes
Given a singly linked list, write code to find the most frequent element value in the list and its occurrence.- jp May 18, 2018 in United States
In case of duplicate number of occurrences, return the element value closest to the head.
A solution of time complexity O(N) average is preferred.
Sample Input: 1 2 3 4 2 3 2
Sample Output: Element 2 occurs 3 time(s)
Sample Input: 4 3 5 3 4 5
Sample Output: Element 4 occurs 2 time(s)
| Report Duplicate | Flag | PURGE
Open Chat in New Window