Pergunta de entrevista da empresa Xerox

Write a function that determines the number of 1 bits in the computer's internal representation of a given integer.

Respostas da entrevista

Sigiloso

2 de abr. de 2009

You can actually find the answer to this question in the book Programming Interviews Exposed by John Morgan et. al. This is actually a VERY helpful book for this interview and all other programming interviews

Sigiloso

8 de out. de 2014

// C# code int num = 619; // The number int NumOfOnes = 0; for (int j=0; j> 1; // Shift right to get the next bit } Console.WriteLine(NumOfOnes);