Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

count number of bits set in a number

    int count_one (int n)
        {
            while( n )
            {
            n = n&(n-1);
               count++;
            }
            return count;
    }
Source by www.hackerearth.com #
 
PREVIOUS NEXT
Tagged: #count #number #bits #set #number
ADD COMMENT
Topic
Name
6+5 =