Easy
Quiz
#191 Number of 1 Bits
APPROACH
Given a positive integer n, write a function that returns the number of set bits in its binary representation (also known as the Hamming weight).
1 of 4
What is the optimal approach for this problem?
#191 Number of 1 Bits
APPROACH
Given a positive integer n, write a function that returns the number of set bits in its binary representation (also known as the Hamming weight).
What is the optimal approach for this problem?