Geeksforgeeks

X

DAYS

:

HOUR

:

MINS

:

SEC

Error

Copied to Clipboard

Given an array arr[] of N positive integers. Find an integer denoting the** maximum XOR subset** value in the given array arr[].

**Example 1:**

Input :N = 3 arr[] = {2, 4, 5}Output :7Explanation :The subset {2, 5} has maximum subset XOR value.

**Example 2 :**

Input :N= 3 arr[] = {9, 8, 5}Output :13Explanation :The subset {8, 5} has maximum subset XOR value.

You don't need to read input or print anything. Your task is to complete the function **maxSubarrayXOR()** which takes the array and an integer as input and returns the maximum subset XOR value.

1 <= N <= 10

1 <= arr[i] <= 10^{6}

We are replacing the old Disqus forum with the new Discussions section given below.

Click here to view old Disqus comments.

Click here to view old Disqus comments.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Maximum subset XOR

...