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 8940ac5 commit 02e02e5Copy full SHA for 02e02e5
counting-bits/hi-rachel.ts
@@ -0,0 +1,8 @@
1
+function countBits(n: number): number[] {
2
+ const result: number[] = new Array(n + 1).fill(0);
3
+
4
+ for (let i = 0; i <= n; i++) {
5
+ result[i] = result[i >> 1] + (i & 1);
6
+ }
7
+ return result;
8
+}
0 commit comments