[leetcode]Single Number
见过。所以就用XOR就行了。
public class Solution {
    public int singleNumber(int[] A) {
        int a = A[0];
        for (int i = 1; i < A.length; i++)
        {
            a ^= A[i];
        }
        return a;
    }
}
见过。所以就用XOR就行了。
public class Solution {
    public int singleNumber(int[] A) {
        int a = A[0];
        for (int i = 1; i < A.length; i++)
        {
            a ^= A[i];
        }
        return a;
    }
}
