Minimum number of operations to make XOR of array equal to zero

You are given an array of n non-negative integers. Your task is to find the minimum number of operations to make XOR of array equal to zero by performing the operations which are defined as follows:



Select the element on which you will perform the operations. Note that all the operations must be performed only on the selected element.
The operation that can be performed are increment and decrement by one.

Examples
Input:
No. of elements in array = 3
Elements = 2 4 7
Output:
1

Expl...
 •  0 comments  •  flag
Share on Twitter
Published on October 12, 2020 01:49
No comments have been added yet.