class Solution {
public:
int singleNumber(vector<int>& nums) {
int ans = 0;
for(auto num : nums) ans ^= num;
return ans;
}
};
[Leetcode bit operation (exclusive or nature) C++] 136. Single Number
Guess you like
Origin blog.csdn.net/m0_37454852/article/details/113920608
Recommended
Ranking