class Solution { public: int singleNumber(vector& nums) { int x = 0; for (int n : nums) { x = x ^ n; } return x; } };