We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 432fda4 commit 10d6a8fCopy full SHA for 10d6a8f
number-of-1-bits/devyejin.py
@@ -0,0 +1,7 @@
1
+class Solution:
2
+ def hammingWeight(self, n: int) -> int:
3
+ result = 0
4
+ while n:
5
+ result += n % 2
6
+ n //= 2
7
+ return result
0 commit comments