String-Max Frequency

I can’t find any way how to proceed with the problem.Please help in this problem.

Okay so you know there are total 256 characters in c++(don’t know exactly how much but i guess , itne he hote hai) So do what make a frequency array. By this i mean make an array which will have a count of how many time a charcter has occured in a string for example you have a string: aaaqqwwccaaawwwcc
Now make a frequency array in which you can see how many time a is coming ,q is coming ,w is coming, c is coming and you will find that
frequency[a] = 6
frequency[q] = 2
frequency[w] = 5
frequency[c] = 4
now out of this a is the most occurring element so you can print it as an answer.

This is an O(N) approach, there is also a O(NlogN) approach without using frequency map but i would sugeest you to first try it using frequency array then go for O(NlogN) cause that would require more problem solving skill.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.