Maximizing XOR Discussions | Algorithms | HackerRank
  • + 0 comments

    For me what works is taking a few examples and trying to find a pattern. Once I find a pattern, I convince myself that it will work for all cases or try to find a test case that will fail. Once I find a test case that fails I'll try to modify the pattern or come up with a new pattern. Like in this case the pattern was the MSB that differs between the two numbers. Hope this helps.