https://leetcode.com/problems/sum-of-all-subset-xor-totals/?envType=daily-question&envId=2024-05-20
/**
* @param {number[]} nums
* @return {number}
*/
var subsetXORSum = function(nums) {
let sum = 0
for (let num of nums) {
sum |= num
}
return sum * (1 << (nums.length - 1))
};
Top comments (0)