Given an array a, find a single number in a
public class YH {
public static void main(String[] args) {
int[] a=new int[] {2,8,1,1,8,3,2};
int r=0;
for(int i=0;i< 7;i++) {
r^=a[i];//The XOR "^" is 0 for the same, and 1 for the difference; for example: 0^s=s, s^s=0, a^b^b^a =0;
}
System.out.println(r);
}
}