You are viewing a single comment's thread. Return to all comments →
System.out.println((((k - 1) | k) > n && k % 2 == 0) ? k - 2 : 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 →
Replace your code with this line:
System.out.println((((k - 1) | k) > n && k % 2 == 0) ? k - 2 : k - 1);