Close

XOR of all sub arrays

Given an array of elements, how do we find the XOR of each sub-array and XOR of those results? For example let us consider the array [1, 2, 3], all possible sub-arrays are XOR[1] = 1XOR[1, 2] = 1 ^ 2 = 3XOR[1, 2, 3] = 1 ^ 2 ^ 3 = 0XOR[2] = 2XOR[2,…