Skip to content

Commit e73ddaa

Browse files
committed
aded comment
1 parent de5eab7 commit e73ddaa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Missing Number/code.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
var missingNumber = function (nums) {
2-
let xor = 0;
2+
let xor = 0;
33
for (let i = 0; i < nums.length; i++) {
44
if (nums[i] != 0)// remove thyis condition keeping the body if no zero slot
55
xor ^= nums[i];
66
xor ^= (i + 1);
77

88
}
99
return xor;
10-
11-
}
10+
//return XOR ^ ARRAY.length + 1; if your array doesn't have empty zero slot.
11+
12+
};

0 commit comments

Comments
 (0)