Problem statement

https://leetcode.com/problems/unique-number-of-occurrences/

Solution

Just use counter here and then check that all frequencies are different.

Complexity

It is O(n) for time and space.

Code

class Solution:
    def uniqueOccurrences(self, arr):
        cnt = Counter(arr).values()
        return len(cnt) == len(set(cnt))