We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb9dd7b commit a371a2eCopy full SHA for a371a2e
counting-bits/printjin-gmailcom.py
@@ -0,0 +1,6 @@
1
+class Solution:
2
+ def countBits(self, n):
3
+ ans = [0] * (n + 1)
4
+ for i in range(1, n + 1):
5
+ ans[i] = ans[i >> 1] + (i & 1)
6
+ return ans
0 commit comments