| 9 | { |
| 10 | public: |
| 11 | int singleNumber(vector<int> &nums) |
| 12 | { |
| 13 | //initialised the xor of numbers in xorr variable |
| 14 | int xorr = 0; |
| 15 | //Linearly traversing the array |
| 16 | for (auto x = 0; x < nums.size(); x++) |
| 17 | { |
| 18 | //Calculating Xor of two numbers . |
| 19 | xorr = xorr ^ nums[x]; |
| 20 | |
| 21 | } |
| 22 | |
| 23 | // Atlast return the final xor . |
| 24 | |
| 25 | return xorr; |
| 26 | } |
| 27 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected