number of 1's bits code example
Example 1: bit counting
countBits = (n) => n.toString(2).split("0").join("").length;
Example 2: find no of 1's in a binary number
len(''.join(str(bin(122011)).split('0')))-1
countBits = (n) => n.toString(2).split("0").join("").length;
len(''.join(str(bin(122011)).split('0')))-1