Given an array of integers, determine whether the frequency of each distinct element is unique. That is, no two different numbers should have the same count of occurrences.
For the array: [1, 2, 2, 1, 1, 3]
1
is 3
.2
is 2
.3
is 1
.Since all frequencies are unique (3
, 2
, and 1
), the function should return true.
For the array: [1, 2, 2, 3, 3]
1
is 1
.2
is 2
.3
is 2
.Frequencies 2
appears twice, so the function should return false.
This problem is a perfect practice for utilizing hash map techniques to solve frequency counting challenges. Enjoy coding and have a great day on this special February day!