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:

https://www.hackerrank.com/challenges/maximizing-xor/forum you’ll find it here.

2 Likes