class Solution:
def hammingWeight(self, n: int) -> int:
out=0
for i in range(32):
out+=(n&1)
n>>=1
return out
191. Number of 1 Bits
最新推荐文章于 2024-08-15 05:02:54 发布
class Solution:
def hammingWeight(self, n: int) -> int:
out=0
for i in range(32):
out+=(n&1)
n>>=1
return out