//https://leetcode.com/problems/counting-bits/
/**
- Note: The returned array must be malloced, assume caller calls free().
/
int bin(int n)
{
int c=0;
while(n>0){
if(n%2==1)
c++;
n=n/2;
}
return c;
}
int countBits(int n, int* returnSize){
n++;
int ans=(int)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
ans[i]=bin(i);
return ans;
}