In: Computer Science
PYTHON 3:
Write a recursive function that takes a non-negative integer n as input and returns the number of 1's in the binary representation of n.
Use the fact that this is equal to the number of 1's in the representation of n//2 (integer division) plus 1 if n is odd.
>>>numOnes(0) 0 >>>numOnes(1) 1 >>>numOnes(14) 3