C++简洁代码:

class Solution {
public:
    void FindNumsAppearOnce(vector<int> data,int* num1,int *num2) {
        unordered_map<int,int> map;
        vector<int> res;
        for(int i : data) map[i] ++;
        for(auto it : map) 
            if(it.second == 1) res.push_back(it.first);
        *num1 = res[0], *num2 = res[1];
    }
};