Number of 1 Bits
就是elements里面介绍的快速找最末尾1的方法
class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
cur = n
result = 0
while cur:
result += 1
cur &= (cur - 1)
return result