Skip to content

Instantly share code, notes, and snippets.

@p53ud0k0d3
Created March 19, 2015 15:56
Show Gist options
  • Save p53ud0k0d3/2b282772280e842f64ce to your computer and use it in GitHub Desktop.
Save p53ud0k0d3/2b282772280e842f64ce to your computer and use it in GitHub Desktop.
HackerRank Maximizing XOR
#!/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