You are viewing a single comment's thread. Return to all comments →
Java : T.C= O(r-l), Using properties of Bitwise operation. All-Correct
public static int maximizingXor(int l, int r) { int max=Integer.MIN_VALUE; int a,b; a=l; for(int i=l;i<r;i++) { b=i+1; if(a!=b) { if((a^b) > max) max=a^b; } // assign a=b b=a^b; a=a^b; } return max; }
}
Maximizing XOR
You are viewing a single comment's thread. Return to all comments →
Java : T.C= O(r-l), Using properties of Bitwise operation. All-Correct
}