Apple Interview Question

Count bits set in a byte

Interview Answer

Anonymous

Jun 24, 2019

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

1