Unique number -2

sir in the video, sir is saying that the most significant bit of the result can can only be present in one of the two unique numbers in the array . But what about the consecutive unique numbers, they both have same bit at first position. how can we find both numbers from their xor .

@tejuschaturvedi0 suppose there are two unique numbers, that guarantees there xor will not be 0, now for ith bit (starting from the most significant bit, ie from the LEFT)
if both bits are same, then xor = 0
if both bits are diff, then xor = 1
so in the result, the first bit that is 1, it will be 1 ONLY if both of these bits were different in the unique numbers, if they were they same the XOR would have been 0.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.