Quote:
Below solution I don't understand the use of 30 in line 19 of c++ program.
reread this part:
Quote: Sum of bitwise AND of all subarrays - GeeksforGeeks
Efficient Solution: For the sake of better understanding, let’s assume that any bit of an element is represented by the variable ‘i’ and the variable ‘sum’ is used to store the final sum.
The code is assuming int are 32 bits and numbers are never negative.
So 31 bits to check,
from bit 0 to 30.
So the program fail with negative numbers.