劍指offer-面試題15-二進制中1的個數-位運算-python

#-*- coding:utf-8 -*- ''' description: 位與 面試題15: 二進制中1的個數 ''' class Solution: ''' 這種方法若是有負數會陷入死循壞 ''' def num_of_1(self, n): count = 0 while n: if n & 1:
相關文章
相關標籤/搜索