191. 位1的个数
解法一:
class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
count = 0
str1 = bin(n)[2:]
for s in str1:
if s == '1':
count += 1
return count最后更新于