Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // kernighan's algorithm
- ll numberofones(ll n){
- ll counter = 0;
- while (n) {
- n &= (n - 1);
- counter++;
- }
- return counter;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement