Skip to content

Instantly share code, notes, and snippets.

@kanrourou
Created November 1, 2017 05:38
class Solution {
public:
bool isPowerOfTwo(int n) {
if(n <= 0)return false;
return !(n & (n - 1));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment