You are viewing a single comment's thread. Return to all comments →
public static void main(String[] args) { try (Scanner sc = new Scanner(System.in);) { int l = sc.nextInt(); int r = sc.nextInt(); System.out.println(allOne(l ^ r)); } } public static int allOne(int i) { i |= (i >> 1); i |= (i >> 2); i |= (i >> 4); i |= (i >> 8); i |= (i >> 16); return i; }
Seems like cookies are disabled on this browser, please enable them to open this website
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →