Skip to content

Commit 28aae80

Browse files
committed
Time: 237 ms (5.02%), Space: 23 MB (85.7%) - LeetHub
1 parent 4f99cb0 commit 28aae80

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
def countBits(self, n: int) -> List[int]:
3+
arr=[]
4+
count=0
5+
for i in range(0, n + 1):
6+
for j in range(0,32):
7+
if(i&1==1):
8+
count+=1
9+
i >>= 1
10+
arr.append(count)
11+
count=0
12+
return arr

0 commit comments

Comments
 (0)