Given an array of integers, every element appears twice except for one. Find that single one.
class Solution {
public:
int singleNumber(int A[], int n) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
int x = A[0];
for(int i=1; i<n; i++) {
x ^= A[i];
}
return x;
}
};