Past Challenges
leetle
486. Frequent Character Difference
Given a string s, find the difference between the frequency of the most frequent character and the least frequent character. Only consider characters that appear at least once in the string.
Example:
Input: s = "aabbbc"
Output: 2
Explanation: 'b' appears 3 times, 'c' appears 1 time. 3 - 1 = 2.
Make sure you return your solution, don't print!
Python3 Code
def solve(s):
pass