Solution to Number Of One In Binary from Jobdu

2 Aug

Question (in Chinese):

Question Name: Number Of One In Binary

Question Description: Give an integer, check how many 1(s) are there in its binary form.

Input: may contains multiple test cases. The first line indicates how many test cases are there in the following input. Each of the next lines contains one integer as a test case.

Output: the number of 1(s) for each test case.

The challenge should appear in the Elements of Programming Interviews: The Insiders’ Guide. The book is on the way to me. So I cannot make sure.

Leave a Reply

Your email address will not be published. Required fields are marked *