Can anyone suggest me a O(n) algorithm for OR the result of pairwise XOR operations on N numbers for example let N=3 and numbers be 5,7 and 9
5 ^ 7 = 2, 7 ^ 9 = 14, 9 ^ 5 = 12
2|14|12 = 14
^ for XOR operation and | for OR operation
If
A[i]differs fromA[j]ink-th bit then:either
A[i]differs fromA[1]ink-th bitor
A[j]differs fromA[1]ink-th bitSo, N operations are enough: