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 cd5accd commit 173cf0fCopy full SHA for 173cf0f
counting-bits/kayden.py
@@ -0,0 +1,10 @@
1
+# 시간복잡도: O(N)
2
+# 공간복잡도: O(N)
3
+class Solution:
4
+
5
+ def countBits(self, n: int) -> List[int]:
6
+ ans = [0 for _ in range(n + 1)]
7
+ for num in range(1, n + 1):
8
+ ans[num] = ans[num >> 1] + (num & 1)
9
10
+ return ans
0 commit comments