python
class Solution:
def hammingWeight(self, n: int):
res = 0
if n < 0:
n = n & 0xffffffff
while n != 0:
n = n & (n-1)
res += 1
return res
python
class Solution:
def hammingWeight(self, n: int):
res = 0
if n < 0:
n = n & 0xffffffff
while n != 0:
n = n & (n-1)
res += 1
return res