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
배열들의 갯수를 카운팅했을때,
카운팅의 갯수가 다를경우 True
같은경우 False를 반환한다.
Counter와 Set을 통해 끝낼 수 있다.
class Solution:
def uniqueOccurrences(self, arr: List[int]) -> bool:
count = Counter(arr)
counter_count = []
if len(set(count.values())) != len(count):
return False
else:
return True
[LeetCode][Python] 380. Insert Delete GetRandom O(1) (0) | 2024.01.17 |
---|---|
[LeetCode][Python] 2225. Find Players With Zero or One Losses (0) | 2024.01.15 |
[Programmers][Python] 프로세스 (1) | 2024.01.10 |
[LeetCode][Python] 1235. Maximum Profit in Job Scheduling (0) | 2024.01.06 |
[Programmers][Python] 캐시 (0) | 2024.01.05 |
댓글 영역