Bit Operation
Single Number
Input: [2,2,1]
Output: 1Input: [4,1,2,1,2]
Output: 4class Solution{
public:
int bitwise(vector<int>& nums){
int res = 0;
for(int num: nums){
res ^= num
}
return res;
}
}Last updated