LeetCode weekly contest 156
赛后补题。
1207. Unique Number of Occurrences
Record the number of occurrences of each value by unordered_map.
Check the unique using unordered_set.
Time complexity: O(N),
Space complexity: O(N).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Solution {
public:
bool uniqueOccurrences(vector