Can someone explain the optimal solution for finding the sum of XOR of all sub-arrays of the array. Example:
Input : arr[] = {3, 8, 13} Output : 46
XOR of {3} = 3 XOR of {3, 8} = 11 XOR of {3, 8, 13} = 6 XOR of {8} = 8 XOR of {8, 13} = 5 XOR of {13} = 13
Sum = 3 + 11 + 6 + 8 + 5 + 13 = 46
Thanks in Advance.