https://leetcode.com/problems/number-of-1-bits/
bit manipulation
class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
res = 0
while n:
res += n & 1
n >>= 1
return res