Created
March 19, 2015 15:56
-
-
Save p53ud0k0d3/2b282772280e842f64ce to your computer and use it in GitHub Desktop.
HackerRank Maximizing XOR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
# Complete the function below. | |
def maxXor( l, r): | |
largest = 0 | |
for i in xrange(l, r+1): | |
for j in xrange(l, r+1): | |
if (i^j) > largest: | |
largest = i^j | |
return largest | |
_l = int(raw_input()); | |
_r = int(raw_input()); | |
res = maxXor(_l, _r); | |
print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment