We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
functiontheGreatXor(x){// Write your code hereleti=0,powerOf2Val=0;while(true){if(Math.pow(2,i)>x){powerOf2Val=Math.pow(2,i);break;}i++;}returnpowerOf2Val-x-1;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Great XOR
You are viewing a single comment's thread. Return to all comments →
For JavaScript coders