Skip to content

Commit 34f48d6

Browse files
committed
counting bits
1 parent f3f44e4 commit 34f48d6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

counting-bits/se6816.java

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[] list = new int[n + 1];
4+
for(int i = 0; i <= n; i++) {
5+
list[i] = Integer.bitCount(i);
6+
}
7+
return list;
8+
}
9+
}

0 commit comments

Comments
 (0)