Subsets With a Target XOR
Count the subsets of nums whose items XOR together to exactly target. Subsets are chosen by position, so two equal values at different positions give different subsets. The empty subset counts and its XOR is 0. Return the count as an integer.
Example 1
nums [1,2,3]
target 0
returns 2
The empty subset and the subset 1, 2, 3 (1 ^ 2 ^ 3 = 0) both give 0.
Example 2
nums [1,2,3]
target 3
returns 2
The subsets 3 and 1, 2 both XOR to 3.
Constraints
1 <= len(nums) <= 120 <= nums[i] <= 10000 <= target <= 1023
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.