2020-11-06
统计整数转换为二进制数中位1的个数:
int getBitNum(int n)
{
int count = 0;
while (n) {
n = n & (n - 1);
count++;
}
return count;
}
作者:wtffqbpl
链接:https://leetcode-cn.com/problems/sort-integers-by-the-number-of-1-bits/solution/cyu-yan-to



