class Solution { public: int singleNumber(int A[], int n) { //异或 int elem = 0; for(int i = 0; i < n ; i++) { elem = elem ^ A[i]; } return elem; } };