136. Single Number

 

 

136. Single Number

 

class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int res = 0;
        for(int i=0; i<nums.size(); i++)
        {
            res ^=nums[i];
        }
        return res;
        
    }
};

 

https://leetcode.com/problems/single-number/description/

posted on 2018-12-03 22:50  鹅要长大  阅读(119)  评论(0编辑  收藏  举报

导航