class Solution {
public:
int hammingWeight(uint32_t n) {
int ans=0;
while(n) ++ans,n-=n&-n;
return ans;
}
};
Leetcode 191. 位1的个数
猜你喜欢
转载自blog.csdn.net/bendaai/article/details/81144758
今日推荐
周排行