标签:off 数组 vector number enum single cto solution 运算
class Solution {
public:
int singleNumber(vector<int>& nums) {
int once, twice = 0;
for(int i = 0; i < nums.size(); i++)
{
once = once ^ nums[i] & ~twice;
twice = twice ^ nums[i] & ~once;
}
return once;
}
};
【剑指offer】【位运算】56 - II. 数组中数字出现的次数 II
标签:off 数组 vector number enum single cto solution 运算
原文地址:https://www.cnblogs.com/Trevo/p/12760250.html