Hello, this problem was asked in one of my coding tests.
Minimum number of changes in an array to ensure that XOR of all K consecutive elements is zero
1 ≤ k ≤ n ≤ 10^4 0 ≤ A[i] < 1024
We have an array of size N
Now, we want to change the array such that the Bitwise XOR of every K Consecutive elements becomes 0. Find the minimum number of elements we need to change.
Input format: Input consists of 2 arguments, first is vector A and second is K.
Output format: Return a single integer, the minimum number of changes required.
Example: A=[1, 2, 3, 1], K=3; Output = 0.
A=[1, 2, 5] K=3; Output = 1.