You are viewing a single comment's thread. Return to all comments →
Great answer! Here is the code
public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int a0 = 0; a0 < t; a0++){ int n = in.nextInt(); int k = in.nextInt(); if(((k-1)|k) > n && k%2==0){ System.out.println(k-2); }else{ System.out.println(k-1); } } } }
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 →
Great answer! Here is the code