class Solution {
public:
void FindNumsAppearOnce(vector<int> data,int* num1,int *num2) {
int count = 0;
int n = data.size();
if(n<2)
{
*num1=0;
*num2=0;
return;
}
for(int i=0;i<n;i++)
{
count ^= data[i];
}
int i = 0;
while((count & (0x1<<(i)))==0)i++;
int *a = new int[n];
int ka = 0;
int *b = new int[n];
int kb = 0;
for(int j=0;j<n;j++)
{
if(((data[j]&(0x1<<i))!=0))
{
a[ka++]=data[j];
}
else
{
b[kb++]=data[j];
}
}
*num1 = 0;
*num2 = 0;
for(i=0;i<ka;i++)
{
*num1^=a[i];
}
for(i=0;i<kb;i++)
{
*num2^=b[i];
}
}
};