You are viewing a single comment's thread. Return to all comments →
hmmm. this code passes all five tests and looks nearly identical to yours?
Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0; i < t; i++) { int max = 0; int n = in.nextInt(); int k = in.nextInt(); for (int a = 1; a < n-1; a++) { for (int b = a+1; b <= n; b++) { int val = a&b; if (val > max && val < k) max = val; } } System.out.println(max); }
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 →
hmmm. this code passes all five tests and looks nearly identical to yours?