MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / countBit

Function countBit

CPP/bitmasking/count_bits.cpp:8–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#define mod 1000000007
7#define endl '\n'
8int countBit(int n){
9int count=0;
10 while(n>0){
11 int last=(n&1);
12 count+=last;
13 n=n>>1;
14 }
15 return count;
16}
17int countBit_fast(int n){
18 int ans=0;
19 while(n>0){

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected