Number of 1 Bits

Problem Id: 191 Difficulty: Easy


Intuition

Solution


class Solution(object):
    def hammingWeight(self, n):
        """
        :type n: int
        :rtype: int
        """
        return bin(n).count('1')