2017-3-7-lint82single-number

2017-3-7-lint82single-number

problem

82single-number/

solution

    int singleNumber(vector<int> &A) {
        // write your code here
        if (A.empty())
            return 0;
        int result = A[0];
        for (int i = 1; i < A.size(); i++)
        {
            result = result ^ A[i];
        }
        return result;
    }
posted @ 2017-03-07 22:40  在河之博  阅读(101)  评论(0编辑  收藏  举报