int ans = 0;
for(int i=0;i<A.size();i++)
ans = ans^A[i];
return ans;
C++ Solution XOR (4 Line)
Read the question the again, “every element appears twice except for one”. So there can’t be three instances of any number.
Read the question the again, “every element appears twice except for one”. So there can’t be three instances of any number.