Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit 94f07af

Browse files
committed
created a solution for problem67
1 parent 526f46a commit 94f07af

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

problem67/Solution1.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def countBits(self, n: int) -> List[int]:
3+
ans = []
4+
for i in range(n+1):
5+
ones = 0
6+
while i != 0:
7+
if i & 1 == 1: ones += 1
8+
i >>= 1
9+
ans.append(ones)
10+
return ans

0 commit comments

Comments
 (0)