728x90
https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/
class Solution:
def areOccurrencesEqual(self, s: str) -> bool:
count = s.count(s[0])
for n in s[1:]:
if s.count(n) != count:
return False
return True
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 2670. Find the Distinct Difference Array (0) | 2024.03.07 |
---|---|
[Leetcode] 1207. Unique Number of Occurrences (0) | 2024.03.06 |
[Leetcode] 1748. Sum of Unique Elements (0) | 2024.03.04 |
[Leetcode] 2405. Optimal Partition of String (0) | 2024.03.04 |
[Leetcode] 2215. Find the Difference of Two Arrays (0) | 2024.03.03 |