We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static int maximizingXor(int l, int r) {
// Write your code here
int res=0;
int xor=0;
int fval=0;
for(int i=l;i<=r;i++){
for(int j=i;j<=r;j++){
res=i^j;
if(xor
fval=xor;
}
return fval;
}
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →
JAVA SOLUTION || Brute+BitManipulation
public static int maximizingXor(int l, int r) { // Write your code here int res=0; int xor=0; int fval=0; for(int i=l;i<=r;i++){ for(int j=i;j<=r;j++){ res=i^j; if(xor fval=xor; } return fval; }