Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique.
 
Example 1:
Input: arr = [1,2,2,1,1,3]
Output: true
Explanation: The value 1 has 3 occurrences, 2 has 2 and 3 has 1. No two values have the same number of occurrences.
Example 2:
Input: arr = [1,2]
Output: false

Example 3:
Input: arr = [-3,0,1,-3,1,1,1,-3,10,0]
Output: true

 
Constraints:

1 <= arr.length <= 1000
-1000 <= arr[i] <= 1000

Difficulty: EASY
Tags: Data structures
Skill types: Data structures

Starter code:
class Solution:
    def uniqueOccurrences(self, arr: List[int]) -> bool:
        

Solutions:
from collections import defaultdict

class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		occurences = defaultdict(int)
		for i in arr:
			occurences[i] += 1
		for i in occurences.values():
			if list(occurences.values()).count(i) > 1:
				return False
		return True


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		c = Counter(arr)
		freq = list(c.values())
		return len(freq) == len(set(freq))


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		l = list(set(arr))
		for i in range(len(l)):
			l[i] = arr.count(l[i])
		if len(l) == len(set(l)):
			return True
		else:
			return False


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		occur = {}
		check = set()
		for num in arr:
			if num not in occur:
				occur[num] = arr.count(num)
		for num in occur.values():
			check.add(num)
		if len(occur) == len(check):
			return True
		return False


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		res = False
		occ = []
		n = 0
		for i in range(0, len(arr)):
			if arr[i] in arr[0:i]:
				pass
			else:
				n = arr.count(arr[i])
				occ.append(n)
		c = 0
		for j in range(0, len(occ)):
			for k in range(j + 1, len(occ)):
				if occ[j] == occ[k]:
					c = 1
					res = False
					break
				else:
					c = 0
					res = True
			if c == 1:
				break
		return res


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		count = {}
		for a in arr:
			if a not in count:
				count[a] = 1
			else:
				count[a] += 1
		occ = []
		for c in list(count.values()):
			if c not in occ:
				occ.append(c)
			else:
				return False
		return True


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		count = Counter(arr)
		s = set()
		for (k, v) in list(count.items()):
			if v in s:
				return False
			else:
				s.add(v)
		return True


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		from collections import Counter
		count_dict = dict(Counter(arr))
		count_occurrences = [j for (i, j) in list(count_dict.items())]
		return len(set(arr)) == len(set(count_occurrences))


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		occd = {}
		for n in arr:
			if n in occd:
				occd[n] += 1
			else:
				occd[n] = 1
		s = set()
		for (k, v) in occd.items():
			if v in s:
				return False
			s.add(v)
		return True


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		counter = {}
		for i in arr:
			counter[i] = counter.get(i, 0) + 1
		return len(counter.values()) == len(set(list(counter.values())))


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		dct = {}
		for num in arr:
			if num in dct:
				dct[num] += 1
			else:
				dct[num] = 1
		return len(list(dct.values())) == len(set(dct.values()))


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		rec = [arr.count(elem) for elem in set(arr)]
		return len(rec) == len(set(rec))


class Solution:

	def uniqueOccurrences(self, arr: List[int]) -> bool:
		unique = set(arr)
		sol = []
		for i in unique:
			sol.append(arr.count(i))
		print(sol)
		for i in sol:
			if sol.count(i) > 1:
				return False
		return True