leetcode1207

 1 import collections
 2 class Solution:
 3     def uniqueOccurrences(self, arr: List[int]) -> bool:
 4         obj = collections.Counter(arr).items()
 5         dic = {}
 6         for o in obj:
 7             if o[1] not in dic:
 8                 dic[o[1]] = o[0]
 9             else:
10                 return False
11         return True

猜你喜欢

转载自www.cnblogs.com/asenyang/p/11622246.html