Help in xor

Given two integers, L and R, find the maximal value of A[xor]B SUCH THAT A[XOR]B IS MAXIMUM AND L<=A<=B<=R.
link to the problem:

THE EDITORIAL EXPLAINS BRUTE FORCE .CAN ANYONE SUGGEST ME AN EFFICIENT APPROACH
link to editorial:

Maximizing XOR Discussions | Algorithms | HackerRank you’ll find it here.

2 Likes