We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0f3f52 commit 1553045Copy full SHA for 1553045
javascript/1863-sum-of-all-subset-XOR-totals.js
@@ -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