Problem Description
R
and X
are two programs.
R
takes an integer array as input and randomly chooses a subsequence of size 4 from it.
X
takes an integer array as input and returns the bitwise XOR of all elements.
You pass an integer array A to R
and pass the output from R
to X
. What's the maximum result you can get?
A = [1, 2, 3, 4]
Input 2:
A = [0, 2, 3, 1, 5]
4
Output 2:
7
R must choose all the elements and X returns 4
Explanation 2:
R can choose [0, 3, 1, 5]. X returns 7
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.