A Zero Xor Subset is a non-empty subset having Xor of all the elements in it equal to 0.
Now you are given an array of N numbers.
You have to count the number of different Zero Xor Subsets of this array.
Input:
First line contains a number N
N is the length of the array.
Second line contains the N elements of the array.
Output:
Single number denoting the Count of Zero Xor Subsets of the given array.
Input Constraints:
1<=N<=40
1<=a[i]<=1018
Hint:
Meet in the middle
For [1, 2, 3] ,there is only 1 subset (1, 2, 3) having Xor (1 ^ 2 ^3) = 0.
So, the answer is 1.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor