Maximum XOR subset
##### Submissions: 2090   Accuracy: 32.44%   Difficulty: Medium   Marks: 4

Given a set A[ ] of positive integers. The task is to find the maximum XOR value of the elements from all the possible subsets.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow.
The first line of each test case contains an integer N, where N is the size of the set A[ ]. The second line of each test case contains N space separated integers, denoting elements of the set A[ ].

Output
Print out the maximum XOR subset value.

Constraints
1 <= T <= 100
1 <= N <= 30
0 <= A[i] < 1000

Examples:
Input:
3
3
2 4 5
3
33 73 64
9
5 633 64 43 131 51 87 999 23

Output:
7
104
1023

Explanation:
Testcase 1:
The maximum XOR value form possible subsets of the given array elements is : 7(2^5), where ^ is the symbol of XOR.

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: Rohan Malhotra

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.