Answers for "is power of 2"

C++
0

is power of 2

bool isPowerOfTwo(int n) {
        
      return n > 0 && !(n&(n-1));
    }
Posted by: Guest on September-28-2021

Code answers related to "is power of 2"

Browse Popular Code Answers by Language