Sunday 23 October 2022

Others - 191. Number of 1 Bits

#===================================
# Tanzila Islam
# Email: tanzilamohita@gmail.com
# Language: Python 3
#===================================
class Solution:
    def hammingWeight(self, n: int) -> int:
        return bin(n).count('1')

No comments:

Post a Comment