首页 > 代码库 > 136. Single Number

136. Single Number

 1 class Solution { 2 public: 3     int singleNumber(vector<int>& nums) { 4         int num = 0; 5         for (const auto& item : nums) { 6             num ^= item; 7         } 8         return num; 9     }10 };
 1 class Solution { 2 public: 3     int singleNumber(vector<int>& nums) { 4         int num = 0; 5         for (const auto& item : nums) { 6             num ^= item; 7         } 8         return num; 9     }10 };

 

136. Single Number