We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Although your code is O(1), any O(b) solution will be of the same complexity or perhaps even faster for cases where b < 4. Here b is the index of MSB in a^b.
A very simple O(b) solution that will work for any values of L & R and will work faster than above code for cases where b < 4
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →
Although your code is O(1), any O(b) solution will be of the same complexity or perhaps even faster for cases where b < 4. Here b is the index of MSB in a^b.
A very simple O(b) solution that will work for any values of L & R and will work faster than above code for cases where b < 4