0231.cpp (95B)
1 class Solution { 2 public: 3 bool isPowerOfTwo(int n) { return n > 0 && !(n & (n - 1)); } 4 };