Leetcode 2053 Solution
This article provides solution to leetcode question 2053 (check-if-all-characters-have-equal-number-of-occurrences)
Access this page by simply typing in "lcs 2053" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences
Solution
class Solution:
def areOccurrencesEqual(self, s: str) -> bool:
m = collections.defaultdict(int)
for ch in s:
m[ch] += 1
return len(set(m.values())) == 1