Skip to content

Commit ff75ccd

Browse files
authored
Update 1835-find-xor-sum-of-all-pairs-bitwise-and.js
1 parent 9db2621 commit ff75ccd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

1835-find-xor-sum-of-all-pairs-bitwise-and.js

+13
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,16 @@ const getXORSum = function(arr1, arr2) {
4040
return res;
4141
};
4242

43+
// another
44+
45+
/**
46+
* @param {number[]} arr1
47+
* @param {number[]} arr2
48+
* @return {number}
49+
*/
50+
const getXORSum = function(arr1, arr2) {
51+
let x1 = arr1[0], x2 = arr2[0]
52+
for(let i = 1; i < arr1.length; i++) x1 ^= arr1[i]
53+
for(let i = 1; i < arr2.length; i++) x2 ^= arr2[i]
54+
return x1 & x2
55+
};

0 commit comments

Comments
 (0)