Fill This Form To Receive Instant Help
Homework answers / question archive / This is Java code
This is Java code. Analyze the efficiency of the algorithm used in the code. Use O-notation.
class Solution {
public int[] countBits(int n) {
int[] out = new int[n + 1];
for (int i = 0; i <= n; i++) {
out[i] = out[i / 2] + i % 2;
}
return out;
}
}