NVIDIA Interview Question

Count number of bits in an integer. You want a fast solution.

Interview Answer

Anonymous

Jul 2, 2021

int count = 0; int input = 249239233; do { count += input & 1; } while (input = input>>1); Is there any faster way?