You are viewing a single comment's thread. Return to all comments →
Here is my C++ solution, you can watch the explanation here : https://youtu.be/yj0yNv6BZa8
long sumXor(long n) { long result = 1; while(n) { result *= (n % 2) ? 1 : 2; n /= 2; } return result; }
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 →
Here is my C++ solution, you can watch the explanation here : https://youtu.be/yj0yNv6BZa8