📅  最后修改于: 2022-03-11 14:52:14.839000             🧑  作者: Mango
/** Check if a number is a power of 2 or not.
* IF n is power of 2, return 1, else return 0.
*/
int powerOfTwo(int n)
{
return n && (!(n & (n-1)));
}