Problem 4

0

0 votes
Ad-Hoc, Implementation, approved, Easy
Problem

You are given an array A of size N. Now, we call the value of an array the BItwise XOR of all elements it contains. For example, the value of the array [1,2,3] = 123. Now, You are required to find the Bitwise XOR of the value of all sub arrays of array A. Can you do it ?

Input:

First line of input contains a single integer T denoting the number of test cases. First line of each test case starts with an integer N denoting the size of the array A. Next line of input contains N space separated integers, where the ith integer denotes the value A[i].

Output:

For each of the test case, print the output in a separate line.

Constraints:

1T20

1N105

1A[i]106

Sample Input
1
2
1 2
Sample Output
0
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For the given input following subarrays are possible : [1], [1 2], [2] and when you XOR them answer is 0.

Editor Image

?