782. Maximum Occurring Character in a String
Given a string s, return the character that occurs the maximum number of times in the string.
If multiple characters have the same highest frequency, return the lexicographically smallest character among them.
Example 1:
Input: s = "takeuforward"
Output: "a"
Explanation: 'a' and 'r' appear 2 times each, but 'a' < 'r', so return 'a'.
Example 2:
Input: s = "apple"
Output: "p"
Explanation: 'p' occurs 2 times, more than others.
Now Your Turn!
Pick the correct output for the given inputInput: s = "zzxyyy"
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= s.length <= 105
- The string contains only lowercase English letters ('a' to 'z')