https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/description/
LeetCode - The World's Leading Online Programming Learning Platform
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
1
2
3
4
5
6
7
8
9
|
class Solution:
def areOccurrencesEqual(self, s: str) -> bool:
check_list = list(set(list(s)))
for i in range(len(check_list) - 1):
if s.count(check_list[i]) != s.count(check_list[i - 1]):
return False
return True
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 31429 SUAPC 2023 Summer (0) | 2024.02.26 |
---|---|
leetcode 3038. Maximum Number of Operations With the Same Score I (0) | 2024.02.18 |
백준 10798 세로읽기 (1) | 2024.02.15 |
leetcode 1732. Find the Highest Altitude (1) | 2024.02.15 |
leetcode 2784. Check if Array is Good (0) | 2024.02.14 |
댓글