2023-09-22 10:49:11 +0000 UTC
Sum of All Subset XOR Totals
Categories:
Links
Code
class Solution:
def subsetXORSum(self, nums: List[int]) -> int:
subsets_count = 2**(len(nums) - 1)
return reduce(operator.or_, nums) * subsets_count