class Solution {
public:
int NumberOf1(int n) {
int count = 0;
while(n){
count ++;
n = (n-1) &n;
}
return count;
}
};
剑指 offer 计算整数里面 1 的个数
猜你喜欢
转载自blog.csdn.net/ttomchy/article/details/104596789
今日推荐
周排行