You are viewing a single comment's thread. Return to all comments →
I love that each challenge is opening me up to new concepts I hadn't encountered before. This was my brute force attempt but times out on 2, 3 and 4
from itertools import combinations for a0 in range(t): n,k = input().strip().split(' ') n,k = [int(n),int(k)] print (max([a&b for a,b in combinations(range(1,n+1), 2) if a&b < k]))
Seems like cookies are disabled on this browser, please enable them to open this website
Day 29: Bitwise AND
You are viewing a single comment's thread. Return to all comments →
I love that each challenge is opening me up to new concepts I hadn't encountered before. This was my brute force attempt but times out on 2, 3 and 4