numbers.
Pick a group of its elements (any of them, not necessarily adjacent; repeated values count as separate elements) so that the bitwise AND of every number in the group is greater than zero. Return the largest possible size of such a group.
The bitwise AND of a one-number group is that number itself, so the answer is always at least 1.numbers=[5, 6, 12, 3] → 3
In binary: 101, 110, 1100, 11. The bit worth 4 is set in 5, 6 and 12, and 5 & 6 & 12 = 4 > 0. All four together fail: 5 & 6 & 12 & 3 = 0.
numbers=[9, 9, 9] → 3
Repeats are separate elements; 9 & 9 & 9 = 9, so all three fit.
numbers=[1, 2, 4] → 1
No two of them share a set bit, so a group can hold only one number.
numbers=[5, 6, 12, 3]
3
Run checks the first 3 tests in your browser. Submit checks all 95 tests on the server, hidden ones included.