191. Number of 1 Bits
Question 191
Input: 11
Output: 3
Explanation: Integer 11 has binary representation 00000000000000000000000000001011 Answer
class Solution(object):
def hammingWeight(self, n):
AnswerINT = 0
while(n):
if(n%2):
AnswerINT += 1
n = n // 2
return AnswerINTLast updated