Most frequent char in a string
I was wondering how you guys find the most frequent character in a string. I'm trying to find the simplest way which also has the best performance.
Currently, I use a dict to count the occurrences and sort it by values. Which is O(nlogn).
What about you guys?
posted this question on 12/20/13 |