Power of Two
EasyBit Manipulation & Math
Decode it first. Clues, constraints, pattern and plan before any code.Return true if the integer n is a power of two (1, 2, 4, 8, ...), otherwise false. Try to do it without a loop.
n = 16 → true (2^4)
n = 1 → true (2^0)
n = 6 → false
n = 0 → falseConstraints
-2^31 <= n <= 2^31 - 1