//sample solution
//2863311530 is the decimal equivalent of 10101010101010101010101010101010
//1431655765 is the decimal equivalent of 01010101010101010101010101010101
function swapAdjacentBits(n) {
return ((n & 2863311530) >> 1) | ((n & 1431655765) << 1);
}
No comments:
Post a Comment