一、只出现一次的数字

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

 

相关文章:

  • 2021-06-24
  • 2021-12-27
  • 2021-07-21
  • 2021-12-15
  • 2021-05-24
  • 2021-09-30
猜你喜欢
  • 2022-12-23
  • 2021-06-19
  • 2022-01-15
  • 2021-10-18
  • 2022-01-03
  • 2021-07-06
  • 2021-10-08
相关资源
相似解决方案