class Solution {
  public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     *
     * @param arr int整型vector
     * @return bool布尔型
     */
    map<int, int>mp;
    map<int, int>::iterator it;
    set<int>se;
    bool uniqueOccurrences(vector<int>& arr) {
        // write code here
        int n = arr.size();
        for (int i = 0; i < n; ++i)
            mp[arr[i]]++;
        for (it = mp.begin(); it != mp.end(); it++) {
            if (!se.count(it->second))
                se.insert(it->second);
            else
                return false;;
        }
        return true;
    }
};

一、题目考察的知识点

map+set

二、题目解答方法的文字分析

map计数,set判重,完美求解

三、本题解析所用的编程语言

c++