Math, asked by yashaswini4170, 1 year ago

You are given a number a. You have to find 2 numbers b and c such that a xor b is minimum and a xor c is maximum.

Answers

Answered by nehatwinpdyyqc
2

Input : arr[] =  {9, 5, 3}

Output : 6

       All pair with xor value (9 ^ 5) => 12,  

       (5 ^ 3) => 6, (9 ^ 3) => 10.

       Minimum XOR value is 6

Input : arr[] = {1, 2, 3, 4, 5}

Output : 1

Similar questions