class Solution {
public:
/*
* @param n: An integer
* @return: True or false
*/
bool checkPowerOf2(int n) {
// write your code here
if(n <= )
return false;
int sum = ;
while(n){
sum += (n&);
n >>= ;
}
if(sum == )
return true;
return false;
}
};
2的幂,二进制表示为 1...0...,最高位为1,其余为0