This commit is contained in:
bt3gl 2023-07-30 21:40:09 -07:00
parent 1d44d182e2
commit a85ed914d3
320 changed files with 0 additions and 0 deletions
bit_manipulation

View file

@ -1,17 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: bt3gl
def count_ones(n: int) -> int:
counter = 0
while n:
if n & 1:
counter += 1
n >>= 1
return counter