Largest Combination With Bitwise AND Greater Than Zero LeetCode solution in JavaScript

1
var largestCombination = function (candidates) {
2
const indexArr = Array(24).fill(0);
3

4
for (let candidate of candidates) {
5
let index = 0;
6
while (candidate > 0) {
7
if ((candidate & 1) === 1) indexArr[index] += 1;
8
candidate >>>= 1;
9
index++;
10
}
11
}
12

13
return Math.max(...indexArr);
14
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0