Tap here to switch tabs
Problem
Submissions

Problem: Sum of All Subset XOR Totals

Sum of All Subset XOR Totals asks you to examine every subset of an integer array, including the empty subset, and return the sum of their XOR totals, counting duplicate-value choices separately.

Statement

Given an array of integers, nums, compute and return the sum of XOR totals for all its possible subsets.

  • A subset is any combination of elements from the original array, nums. This includes the empty subset (containing no elements) and the subset that includes all array elements.

  • The XOR total of a subset results from applying the XOR operation to all the elements in that subset.

Note: If the nums array has duplicate elements, then subsets that contain the same elements but with different indexes are treated as separate. Each subset’s XOR total is counted in the final sum.

Constraints:

  • 1≤1 \leq nums.length ≤12\leq12

  • 1≤1 \leq nums[i] ≤20\leq 20

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of All Subset XOR Totals

Sum of All Subset XOR Totals asks you to examine every subset of an integer array, including the empty subset, and return the sum of their XOR totals, counting duplicate-value choices separately.

Statement

Given an array of integers, nums, compute and return the sum of XOR totals for all its possible subsets.

  • A subset is any combination of elements from the original array, nums. This includes the empty subset (containing no elements) and the subset that includes all array elements.

  • The XOR total of a subset results from applying the XOR operation to all the elements in that subset.

Note: If the nums array has duplicate elements, then subsets that contain the same elements but with different indexes are treated as separate. Each subset’s XOR total is counted in the final sum.

Constraints:

  • 1≤1 \leq nums.length ≤12\leq12

  • 1≤1 \leq nums[i] ≤20\leq 20