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.
Thats precisely what happened to my code (Python 3) before I gave up and came here:
if name == 'main':
t = int(input())
for t_itr in range(t):
nk = input().split()
#Set of numbers up 1 -> n
n = int(nk[0])
#One more than valid maximum value A&B can be
k = int(nk[1])
maxk = 0
for i in range(0,n-1):
for j in range(i+1,n):
curk = i&j
if curk > maxk and curk < k:
maxk = curk
if maxk == (k - 1):
break
if maxk == (k - 1):
break
print (maxk)
As a complete beginner; I do find it queer that you need to use bitwise OR to solve an exercise titled "bitwise AND"
Day 29: Bitwise AND
You are viewing a single comment's thread. Return to all comments →
Thats precisely what happened to my code (Python 3) before I gave up and came here:
As a complete beginner; I do find it queer that you need to use bitwise OR to solve an exercise titled "bitwise AND"