📅  最后修改于: 2022-03-11 15:00:40.881000             🧑  作者: Mango
bool isPowerOfTwo(int x)
{
// x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
return (x && !(x & (x - 1)));
}