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.
Example 1:
|
|
Example 2:
|
|
Example 3:
|
|
Constraints:
1 <= arr.length <= 1000
-1000 <= arr[i] <= 1000
Solutions
By using the map container to record the number of occurrences of each number, and then using the set container to record different occurrences, the size of the map and set can be compared to determine whether they are unique occurrences.
|
|