class Solution {
public:
int hammingWeight(uint32_t n) {
bitset<32>b(n);
return b.count();
}
};
剑指 Offer 15. 二进制中1的个数
最新推荐文章于 2022-04-14 00:41:25 发布
class Solution {
public:
int hammingWeight(uint32_t n) {
bitset<32>b(n);
return b.count();
}
};