Determine if a positive integer is a power of two.
bool isPowerOfTwo(int n) {
if (n <= 0)
return false
return !(n & n-1)
}
Determine if a positive integer is a power of two.
bool isPowerOfTwo(int n) {
if (n <= 0)
return false
return !(n & n-1)
}