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 4edb975 commit c36dd0cCopy full SHA for c36dd0c
1 file changed
number-of-1-bits/mrlee7.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def hammingWeight(self, n: int) -> int:
3
+ result = 0
4
+
5
+ while n > 0:
6
+ result += n % 2
7
+ n //= 2
8
+ return result
9
0 commit comments