'Count the Subarray's which has bitwise and of its elements equal to Zero

Suppose we have a list of numbers

[7,2,9,8,6,12,109,28,14,19]

I want to find a efficient way to count the all sub-list of this list which will have bitwise and equal to zero

like:

[2,5] # 2&5 = 0
[9,5,7,2] # 9&5&7&2 = 0

Let me know if anyone know how to do it most efficiently



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source