Leetcode刷题第003天

Posted 苏格拉底的落泪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Leetcode刷题第003天相关的知识,希望对你有一定的参考价值。

一、只出现一次的数字

 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 };

 

以上是关于Leetcode刷题第003天的主要内容,如果未能解决你的问题,请参考以下文章