Problem statement

https://binarysearch.com/problems/Unique-Occurrences/

Solution

I think I saw the same on leetcode, but it is quite easy already: just evaluate counter and check that all frequencies are different.

Complexity

It is O(n) for time and space.

Code

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