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 10 11 12 | class Solution: def uniqueOccurrences(self, arr: List[int]) -> bool: set_arr = list(set(arr)) chk = [] for num in set_arr: if arr.count(num) in chk: return False else: chk.append(arr.count(num)) return True | cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 3010. Divide an Array Into Subarrays With Minimum Cost I (0) | 2024.01.23 |
---|---|
leetcode 645. Set Mismatch (0) | 2024.01.22 |
leetcode 2913. Subarrays Distinct Element Sum of Squares I (0) | 2024.01.15 |
leetcode 3005. Count Elements With Maximum Frequency (0) | 2024.01.15 |
leetcode 917. Reverse Only Letters (0) | 2024.01.13 |
댓글