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 5264bee commit b171719Copy full SHA for b171719
0338-counting-bits/0338-counting-bits.java
@@ -0,0 +1,9 @@
1
+class Solution {
2
+ public int[] countBits(int n) {
3
+ int[] out = new int[n+1];
4
+ for(int i = 1 ; i<out.length;i++){
5
+ out[i]=out[i>>1]+i%2;
6
+ }
7
+ return out;
8
9
+}
0 commit comments