Game of XOR

0

0 votes
Open, Open, Open, Implementation, Basic Programming, Ad-Hoc, Easy, approved, Basics of Implementation
Problem

You are given an array \(A\) of size \(N\). The value of the array is the bitwise XOR of the elements that the array contains. For example, the value of the array \([1,2,3]\) = \( 1 \oplus 2 \oplus 3 \). Now, you are required to find the bitwise XOR of the value of all subarrays of array \(A\).

Input format

  • First line: A single integer \(T\) denoting the number of test cases
  • For each test case:
    • First line: An integer \(N\) denoting the size of array \(A\)
  • Next line: \(N\) space-separated integers, where the \(i^{th}\) integer denotes the value \(A[i]\)

Output format

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

Constraints

\( 1 \le T \le 20 \)

\( 1 \le N \le 10^5 \)

\( 1 \le A[i] \le 10^6 \)

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

?