Arrays.sort(A);
for(int i=0;i<A.length-1;i+=2){
if(A[i]!=A[i+1]){
return A[i];
}
}
3 line solution and better than the solution given as a hint
don’t post this kind of solution just for the sake of bragging…you might haven’t noticed that const vector is given which indicates sorting is not the approach here… Everyone can do with sorting isn’t a big deal…