You are viewing a single comment's thread. Return to all comments →
Who solves this task in JavaScript, use BigInt to pass all test cases:
BigInt
function xoringNinja(arr) { return BigInt(arr.reduce((a, b) => a | b, 0)) * 2n ** BigInt(arr.length - 1) % 1000000007n; }
Also it's possible to pass all test cases using only numbers if to count mod manually:
function xoringNinja(arr) { let ans = arr.reduce((a, b) => a | b, 0); for(let i = 1; i < arr.length; i++) { ans <<= 1; if(ans > 1000000006) ans -= 1000000007; } return ans; }
Seems like cookies are disabled on this browser, please enable them to open this website
Xoring Ninja
You are viewing a single comment's thread. Return to all comments →
Who solves this task in JavaScript, use
BigInt
to pass all test cases:Also it's possible to pass all test cases using only numbers if to count mod manually: