Skip to content

Instantly share code, notes, and snippets.

@xzhang311
Created April 11, 2016 17:22
class Solution {
public:
bool isPowerOfTwo(int n) {
double num = log2(n);
return n==0? false:num==round(num);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment