136. Single Number
class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = 0;
for (auto& num : nums)
res ^= num;
return res;
}
};
- T:
- S:
class Solution {
public:
int singleNumber(vector<int>& nums) {
int res = 0;
for (auto& num : nums)
res ^= num;
return res;
}
};