Maximizing XOR Discussions | Algorithms | HackerRank
  • + 0 comments

    Here is my easy and straitghforward solution, you can watch video here : https://youtu.be/pCU8W_ofvDg

    int maximizingXor(int l, int r) {
        int result = 0;
        for(int a = l; a <= r; a++){
            for(int b = a; b<= r; b++){
                result = max(result, a ^ b);
            }
        }
        return result;
    }