freq
to store the frequency of each element in the array.arr
, incrementing the frequency count of each element in freq
.freqSet
to store the unique frequencies.freq
and add each frequency to freqSet
.freqSet
is equal to the size of freq
, return true
. Otherwise, return false
.