Last Updated :
10 Apr, 2024
Find the number of XOR operations required to find element that appears once in an array of n elements. Every other element appears twice
(A) n
(B) n+1
(C) n-1
(D) n/2
Answer: (C)
Explanation:
For example 1,1,2,2,3,3,5 here we have 7 elements so we need six XOR symbols between each of the number to find the answer that is 5(appearing once).
Share your thoughts in the comments
Please Login to comment...