#1941
Check if All Characters Have Equal Number of Occurrences
newbie · 180 · lc easy +15 · premium · verified · 79.4% accepted · 1,036 likes · top 91%
Description
Given a string s, return true if every character in s appears the same number of times, or false otherwise.
Example 1:
Input: s = "abacbc"
Output: true
Explanation: The characters that appear in s are 'a', 'b', and 'c'. All characters occur 2 times in s.
Example 2:
Input: s = "aaabb"
Output: false
Explanation: The characters that appear in s are 'a' and 'b'.
'a' occurs 3 times while 'b' occurs 2 times, which is not the same number of times.
Code
1
2
3