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.
If you're having trouble, notice that a^b = a+b-2*(a&b).
The a and b part has its own formula for some.
for the third term, see that every bit in a would collide with every bit in b that come there or after that. That means if
a = 1100
b = 1001
the first one would collide with all 1s in b and the second one would collide with one in the 4th position of b.
I will not post my answer here. It's supposed to be locked away in the editorial.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Xor and Sum
You are viewing a single comment's thread. Return to all comments →
If you're having trouble, notice that a^b = a+b-2*(a&b). The a and b part has its own formula for some. for the third term, see that every bit in a would collide with every bit in b that come there or after that. That means if a = 1100 b = 1001 the first one would collide with all 1s in b and the second one would collide with one in the 4th position of b.
I will not post my answer here. It's supposed to be locked away in the editorial.