Given an array of integers, every element appears *twice* except for one. Find that single one.

Solution:

class Solution { public: int singleNumber(vector& nums) { int A = nums[0]; for(int i = 1; i < nums.size();i++) { A = A ^ nums[i]; } return A; } };