August 09, 2021
def solution(n): ans = 0 while n > 0: if n % 2 == 0: n /= 2 else: ans += 1 n -= 1 return ans
def solution(n): return bin(n).count('1')
GitHubVelogFacebook