MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / singleNumber

Method singleNumber

C++/Single-Number.cpp:11–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected