Apple interview question

Count bits set in a byte

Interview Answer

Anonymous

24 Jun 2019

int count = 0; while(n) { n &= (n-1); count++; } return count;

1