from collections import Counter
class Solution:
def uniqueOccurrences(self, arr: List[int]) -> bool:
if len(arr) == 2 and arr[0] != arr[1]:
return False
l = Counter(arr)
if len(set(l.values())) == len(l):
return True
else:
return False
力扣 - 独一无二的出现次数 python解
最新推荐文章于 2022-05-04 15:06:13 发布