This question is quite simple.
You will be given 2 numbers let's say 'A' and 'C' and you have to find a number 'B' such that A (+) B = C.
A (+) B = C can be read as A xor B = C.
You can read more about XOR operation here: link
See Sample test-case for more understanding.
Note: In all programming languages, you can XOR two numbers say X and Y by ‘^’ (shift-6) key.
Let's take B as 3:
0101 (decimal 5)
XOR 0011 (decimal 3)
= 0110 (decimal 6)
As we can see that A = 5, C = 6.
So as per formula A (xor) B => C. Suppose B = 3, 5 (xor) 3 => 6 is obtained.
Hence, B = 3 satisfies formula A xor B = C.
Thus, output is 3 as B = 3.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor