Unique Number of Occurrences
EasyArrayMath
Description
Given an array of integers arr, return true if the number of occurrences of each value in the array is unique, or false otherwise.
Examples
Input:
arr = [1,2,2,1,1,3]Output:
trueExplanation:
1→3, 2→2, 3→1, all unique.
Input:
arr = [1,2]Output:
falseExplanation:
Each value appears once, so occurrence counts are [1, 1]. The counts are not unique.
Input:
arr = [5,5,5,7,7,8]Output:
trueExplanation:
Number 5 appears 3 times, number 7 appears 2 times, and number 8 appears 1 time. The occurrence counts are [3,2,1] which are all unique, so return true.
Constraints
- •
1 ≤ arr.length ≤ 1000