Qualcomm Interview Question

How many 1’s in a number? Optimize the code Extract the bits from pod x to n and return the binary equivalent