Python Day 29: Bitwise AND




Given set S={1, 2, 3,..., N}. Find two integers, A and B (where A



  1. #!/bin/python3
  2. import math
  3. import os
  4. import random
  5. import re
  6. import sys
  7. T = int(input().strip())
  8. for _ in range(T):
  9. n , k = map(int , input().split())
  10. print(k-1 if ((k-1) | k) <= n else k-2)




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube