Given a linked list of characters. The task is to find the maximum occurring character in the linked list. if there are multiple answers, return the first maximum occurring character.
Input : g -> e -> e -> k -> s Output : e Input : a -> a -> b -> b -> c -> c -> d -> d Output : d
Iteratively count the frequency of each character in a string and return the one which has maximum occurrence.
Method 2: (use count array)
Create a count array and count each character frequency return the maximum occurring character.
- Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes
- Count substrings with each character occurring at most k times
- Check if max occurring character of one string appears same no. of times in other
- Maximum sum of K consecutive nodes in the given Linked List
- Maximum sum contiguous nodes in the given linked list
- Maximum and Minimum element of a linked list which is divisible by a given number k
- Minimum and Maximum Prime Numbers of a Singly Linked List
- Find minimum and maximum elements in singly Circular Linked List
- Create new linked list from two given linked list with greater element at each node
- Convert singly linked list into circular linked list
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- Difference between Singly linked list and Doubly linked list
- Merge a linked list into another linked list at alternate positions
- Convert Singly Linked List to XOR Linked List
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.