class Solution {
public:
int hammingWeight(uint32_t n) {
int ret = 0;
while(n)
{
ret += n & 1;
n /= 2;
}
return ret;
}
};
leetcode每日一题第九十六天
最新推荐文章于 2024-08-18 18:02:49 发布