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 cf1925e commit 93e06c1Copy full SHA for 93e06c1
counting-bits/s0ooo0k.java
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ public int[] countBits(int n) {
3
+ int[] arr = new int[n + 1];
4
+
5
+ for (int i = 1; i <= n; i++) {
6
+ arr[i] = arr[i >> 1] + (i & 1);
7
+ }
8
9
+ return arr;
10
11
+}
0 commit comments