Split the Array
Easy Accuracy: 10.1% Submissions: 89 Points: 2

Given an array A of n integers, the task is to count the number of ways to split given array elements into two disjoint groups such that XOR of elements of each group is equal.
Note: The answer could be very large so print it by doing modulos with 109 + 7. 

Example 1:

Input : a[] = {1, 2, 3}
Output : 3
{(1),(2, 3)},{(2),(1, 3)},{(3),(1, 2)}
are three ways with equal XOR
value of two groups.

Example 2:

Input : a[] = {5, 2, 3, 2}
Output : 0

Your Task:
The input is already taken care of by the driver code. You only need to complete the function countgroup() that takes an array (a), sizeOfArray (n), and return the number of ways to split an array. The driver code takes care of the printing.

Expected Time Complexity: O(N).
Expected Auxiliary Space: O(1).




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?


All Submissions

My Submissions:

Login to access your submissions.

Split the Array

Output Window