You are viewing a single comment's thread. Return to all comments →
sir can you explain how the below solution is solving this problem.
def maxXOR(L,R): P = L^R ret = 1 while(P): # this one takes (m+1) = O(logR) steps ret <<= 1 P >>= 1 return (ret - 1)
i dont understand that how we are getting right answer by doing this method.
Seems like cookies are disabled on this browser, please enable them to open this website
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →
sir can you explain how the below solution is solving this problem.
def maxXOR(L,R): P = L^R ret = 1 while(P): # this one takes (m+1) = O(logR) steps ret <<= 1 P >>= 1 return (ret - 1)
i dont understand that how we are getting right answer by doing this method.