BETA

Difficulty Level:

Medium

Total Submissions: 570 Accuracy:

21.75%

Maximum subset XOR (Function Problem)
       

Given a set of positive integers. The task is to complete the function  maxSubarrayXOR which returns an integer denoting the maximum XOR subset value in the given set. 

Examples:

Input: set[] = {2, 4, 5}
Output: 7
The subset {2, 5} has maximum XOR value

Input: set[] = {9, 8, 5}
Output: 13
The subset {8, 5} has maximum XOR value



Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains two lines. The first line of input contains an integer N denoting the size of the array A[]. Then in the next line are N space separated values of the array.

Output:
For each test case in a new line output will be the maximum XOR subset value in the given set.

Constraints:
1<=T<=100
1<=N<=50

Example(To be used only for expected output):
Input:

2
3
2 4 5
3
9 8 5
Output:
7
13



Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

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

Contributor: Harshit Sidhwa


					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.