class Solution(object): def hammingWeight(self, n): """ :type n: int :rtype: int """ count = 0 for i in range(32): if (n>>i)%2 == 1: count += 1 return count 赞微海报分享
近期评论