N logn solution


#1

int count=1;
int n=A.size();
vector a=A;
sort(a.begin(),a.end());
for(int i=0;i<n-1;i++)
{
if(a[i]!=a[i+1])
return a[i];
if(a[i]==a[i+1])
{
count++;
if(count==3)
{
i++;
count=1;
}
}
}

return a[n-1];