Maximizing XOR Discussions | Algorithms | HackerRank
  • + 2 comments

    In the spirit of this solution, here's one in Python:

    (1 << (len(format(l^r, 'b')))) - 1