清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
# -*- coding:utf-8 -*- class Solution: def NumberOf1(self, n): if n>=0: nbin = bin(n) count = nbin.count('1') return count else: num = abs(n) nbin = bin(num-1) count = 32-nbin.count('1') return count
2014/12/27 38130
清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
# -*- coding:utf-8 -*- class Solution: def NumberOf1(self, n): if n>=0: nbin = bin(n) count = nbin.count('1') return count else: num = abs(n) nbin = bin(num-1) count = 32-nbin.count('1') return count