Given an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise.
Sort the array and test the adjoint numbers.
class Solution:
def uniqueOccurrences(self, arr: List[int]) -> bool:
cnts = [0] * 1001
for a in arr:
cnts[a] += 1
cnts.sort(reverse=True)
index = 1
while index < 1001 and cnts[index]:
if cnts[index] == cnts[index-1]:
return False
index += 1
return True