Cover image for 面试经典150题 P191 位1的个数

面试经典150题 P191 位1的个数


时间轴

时间轴

2025-11-25

init

__builtin_popcount

题目:

可以直接使用内置函数__builtin_popcount

1234567
class Solution {    public:	int hammingWeight(int n)	{		return __builtin_popcount(n);	}};
评论加载中…