Given an array of integers, every element appears twice except for one. Find that single one.
1 class Solution { 2 public: 3 int singleNumber(vector<int>& nums) { 4 int size=nums.size(); 5 if(size==0||nums.empty()) 6 return 0; 7 int res=0; 8 for(int i=0;i<size;++i) 9 res^=nums[i]; 10 return res; 11 } 12 };