Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save inspirit941/09e90c4b4608aaffa6c77867780c7a50 to your computer and use it in GitHub Desktop.
Save inspirit941/09e90c4b4608aaffa6c77867780c7a50 to your computer and use it in GitHub Desktop.
def solution(n):
cnt = 0
while n > 0:
q, r = divmod(n, 2)
n = q
if r != 0:
cnt += 1
return cnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment