We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2e5e1d commit b2bd259Copy full SHA for b2bd259
1 file changed
Count_set bit
@@ -0,0 +1,8 @@
1
+def count_setbits(n):
2
+ m=[0 for x in range(n+1)]
3
+ m[0]=0
4
+ for i in range(1,n+1):
5
+ m[i]=m[int(i/2)]+i%2
6
+ return m
7
+
8
+print(count_setbits(5))
0 commit comments