Given a list A having N positive elements. The task to create another list such as ith element is XOR of all elements of A except A[i].
A = [2, 1, 5, 9]Output:
13 14 10 6Explanation:
At first position 1^5^9 = 13
At second position 2^5^9 = 14
At third position 2^1^9 = 10
At last position 2^1^5 = 6
A = [2, 1]Output:
At first position except first position
there is only one element = 1
At second position except second position
â€‹there is only one element = 2
You don't need to read input or print anything. Your task is to complete the function getXor() which takes a list A and an integer N which is the size of the list A and return the modified list.
Expected Time Complexity: O(N) Expected Auxiliary Space: O(1), Where N is the size of the input array