


Bits counting algorithm (Brian Kernighan) in an integer time complexityTime complexity is O(logN), count the number of set bits (1) of an integer. Set the right most 1 to 0 one by one. An integer n has log(n) bits. So the time complexity is O(logN).
Hamming Weight
