You are viewing a single comment's thread. Return to all comments →
long sumXor(long n) { long count = 1; while (n > 0) { if ((n & 0x1) == 0) count <<= 1; n >>= 1; } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sum vs XOR
You are viewing a single comment's thread. Return to all comments →
long sumXor(long n) { long count = 1;
while (n > 0) { if ((n & 0x1) == 0) count <<= 1; n >>= 1; } return count; }