We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65708f6 commit c4e90aeCopy full SHA for c4e90ae
number-of-1-bits/river20s.py
@@ -1,13 +1,13 @@
1
-class Solution(object):
2
- def hammingWeight(self, n):
3
- """
4
- :type n: int
5
- :rtype: int
6
- Time complexity: O(1)
7
- Space complexity: O(1)
8
9
- count = 0
10
- for _ in range(32):
11
- count += n & 1
12
- n >>= 1
13
- return count
+class Solution(object):
+ def hammingWeight(self, n):
+ """
+ :type n: int
+ :rtype: int
+ Time complexity: O(1)
+ Space complexity: O(1)
+ count = 0
+ for _ in range(32):
+ count += n & 1
+ n >>= 1
+ return count
0 commit comments