Xor and Sum Discussions | Algorithms | HackerRank
  • + 0 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.