136.|136. Single Number(技巧性非常强)

136.|136. Single Number(技巧性非常强)
文章图片
image.png 136.|136. Single Number(技巧性非常强)
文章图片
image.png
【136.|136. Single Number(技巧性非常强)】用到6

class Solution { public: int singleNumber(vector& nums) { if(nums.empty()) return -1; int result = 0; for(auto iter = nums.begin(); iter != nums.end(); iter++){ result = result ^ *iter; } return result; } };

    推荐阅读