2*(A1^A2^…^An)=(A1|A2|…|An)
Can anyone give me the test case where the above condition is satisfied and the number of elements with highest set bit being odd?
See multiplying by 2 will add an extra zero at the end of binary representation of XOR part, so if the highest bit let say is zero ( for even count) the L.H.S will never be greater than R.H.S.
Example: 1100 , 1011, 1101, 1111.
XOR for them is : 0101, multiplied by 2 gives 1010 and OR is 1111.
Now for odd count:
1100 , 1011 ,1101.
XOR for them is 1010 ,multiplied by 2 gives 10100 and OR is 01111
I didn’t find my answer. I just want to know if there exists any test case where the above condition will be satisfied or not . If yes provide me that test case.
Bro I have written the example for odd count (numbers are 12 , 11 , 13 ) , clearly XOR part is greater than OR.
I don’t asked for greater than condition, see clearly it is equal to condition.
Sorry, my bad. I don’t think it can be equal for odd count at all. You are right, it can only be greater than RHS.