본문 바로가기
python-algorithm

leetcode 1207. Unique Number of Occurrences

by 무적김두칠 2024. 1. 17.

https://leetcode.com/problems/unique-number-of-occurrences/description/?envType=daily-question&envId=2024-01-17

 

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
반응형

댓글