Skip to content

Commit b171719

Browse files
Time: 2 ms (95.27%), Space: 47 MB (16.93%) - LeetHub
1 parent 5264bee commit b171719

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)