Given an integer, write a function to determine if it is a power of two.
好简单。。。
class Solution {
public:
bool isPowerOfTwo(int n) {
if(!n){
return 0;
}
while (n!=1) {
if(n%2!=0){
return 0;
}
n=n/2;
}
return 1;
}
};