Skip to content

Commit 9c38f40

Browse files
author
Jaskaran Singh
authored
Create xor_array.js
1 parent 5e92e10 commit 9c38f40

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

xor_array.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @param {number} n
3+
* @param {number} start
4+
* @return {number}
5+
*/
6+
var xorOperation = function(n, start) {
7+
let total = 0;
8+
9+
for(let i = 0; i < n; i++)
10+
total ^= start + 2 * i;
11+
12+
return total;
13+
};

0 commit comments

Comments
 (0)