Problem :

https://www.hackerrank.com/challenges/maximizing-xor/problem


My Solution :

#!/usr/bin/env python3


def maximizing_xor(l, r):
xor = l ^ r
n = 0
while xor:
n += 1
xor >>= 1
return 2**n - 1


l = int(input())
r = int(input())
result = maximizing_xor(l, r)
print(result)


Comment :

bit 연산 문제는 항상 자신이 없다 ㅠㅠ