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 19151db commit 703cbe0Copy full SHA for 703cbe0
number-of-1-bits/Raft.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def hammingWeight(self, n: int) -> int:
3
+ res = 0
4
+ while n:
5
+ res += n % 2
6
+ n = n >> 1
7
+ return res
8
+# T: logn
9
+# S: 1
10
+
0 commit comments