Find Maximum Occurring Character

E · easyPracticestrings

Find the character that appears most frequently in a string. If tie, print the lexicographically smallest.

Input
programming
Output
g
Frequency array of size 26. Track max frequency. In case of tie, smaller index wins.
← Find Intersection of Two ArraysFind Minimum Element in Array →
Report an issue with this question