Skip to content

Commit e6d4e0d

Browse files
committed
191. Number of 1 Bits Solution
1 parent ca024ee commit e6d4e0d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

number-of-1-bits/doh6077.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Solution:
2+
def hammingWeight(self, n: int) -> int:
3+
binary_num = format(n, 'b')
4+
return binary_num.count('1')

0 commit comments

Comments
 (0)