✅C++✅3 Lines✅XOR Solution
\n# Approach\n- XOR of a number with itself results 0\n- XOR of a number with 0 results a number only\n- XOR of a number with itself, odd number of times result
\n# Approach\n- XOR of a number with itself results 0\n- XOR of a number with 0 results a number only\n- XOR of a number with itself, odd number of times results a number only\n- XOR of a number with itself, even number of times reuslts 0 \n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int singleNonDuplicate(vector<int>& nums) {\n\n        int sum = 0;\n\n        for( auto &it : nums ) \n            sum ^= it;\n\n        return sum ;\n    }\n};\n```
['C++']