class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
cont=0
while(n>0):
cont+=1
n=(n-1)&n
return cont
我的算法之路20--位1的个数
猜你喜欢
转载自blog.csdn.net/joaming/article/details/89478398
今日推荐
周排行