1
class Solution {
2
public boolean uniqueOccurrences(int[] arr) {
3
Arrays.sort(arr);
4
HashSet<Integer> set = new HashSet<>();
5

6
int c = 1;
7
for (int i = 1; i < arr.length; i++) {
8
if (arr[i] == arr[i - 1]) c++;
9
else {
10
if (set.contains(c)) return false;
11

12
set.add(c);
13

14
c = 1;
15
}
16
}
17

18
if (set.contains(c)) return false;
19

20
return true;
21
}
22
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0