Leetcode 1319 Solution

This article provides solution to leetcode question 1319 (unique-number-of-occurrences)

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

Solution

class Solution:
    def uniqueOccurrences(self, arr: List[int]) -> bool:
        m = collections.defaultdict(int)
        for v in arr:
            m[v] += 1
        return len(m) == len(set(m.values()))