Day 4: Counting 1-bits
Tomáš Bouda
51

Counting 1 bits could be done recursivly

def count_1bits(n):
….if n == 0:
……..return 0
….elif n%2 == 0:
……..return count_1bits(n//2)
….else:
……..return 1 + count_1bits(n//2)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.