class Solution {
public:
vector<int>ans;
vector<int>one;
vector<int>another;
vector<int> FindNumsAppearOnce(vector<int>& array) {
int t = 0;
for (int i : array) {
t = t ^ i;
}
//t就是分类标准
int time = 0;
while (t != 1) {
t /= 2;
time++;
}
for (int i : array) {
int x = i >> time;
x = x & 1;
if (x == 1)
one.push_back(i);
else
another.push_back(i);
}
t = 3 ^ 1;
t = 0;
for (int i : one) {
t = t ^ i;
}
ans.push_back(t);
t = 0;
for (int i : another) {
t = t ^ i;
}
ans.push_back(t);
sort(ans.begin(),ans.end());
return ans;
}
};