lowbit解法
二进制中1的个数
http://www.nowcoder.com/questionTerminal/8ee967e43c2c4ec193b040ea7fbb10b8
class Solution {
public:
inline int lowBit(int x) {
return x & -x;
}
int NumberOf1(int n) {
int cnt = 0;
for (; n; ) {
n -= lowBit(n);
cnt ++;
}
return cnt;
}
}; 