Bit Manipulation - Number of 1 Bits (Hamming Weight)
Identify the bug in the following code that attempts to count the number of 1 bits in a signed 32-bit integer:
def hammingWeight(n: int) -> int:
count = 0
while n != 0:
count += n & 1
n >>= 1
return count
