Skip to content

Commit 1553045

Browse files
committed
Create 1863-sum-of-all-subset-XOR-totals.js
1 parent b0f3f52 commit 1553045

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number}
4+
*/
5+
var subsetXORSum = function (nums) {
6+
let bitOR = 0;
7+
for (let i = 0; i < nums.length; ++i) {
8+
bitOR |= nums[i];
9+
}
10+
return (bitOR * Math.pow(2, nums.length - 1));
11+
};

0 commit comments

Comments
 (0)