public class Solution {
public int NumberOf1(int n) {
int result = n;
int count = 0;
while(result!=0)
{
result = ((result-1) & (result));
count++;
}
return count;
}
}
15、二进制中1的个数
最新推荐文章于 2021-03-06 04:44:31 发布