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