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.
publicstaticlongflippingBits(longn){// Write your code herelongflip=0;for(inti=31;i>=0;i--){if(n-Math.pow(2,i)>=0){n-=Math.pow(2,i);}else{flip+=Math.pow(2,i);}}returnflip;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping bits
You are viewing a single comment's thread. Return to all comments →