You are viewing a single comment's thread. Return to all comments →
Java solution using sort:
public static int maximizingXor(int l, int r) { List<Integer> xors = new ArrayList<>(); for (int i = l; i <= r; i++) { for (int j = l; j <= r; j++) { xors.add(i ^ j); } } Collections.sort(xors); return xors.get(xors.size()-1); }
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 →
Java solution using sort: