Power of Four
EasyBit Manipulation & Math
Decode it first. Clues, constraints, pattern and plan before any code.Return true if the integer n is a power of four (1, 4, 16, 64, ...), otherwise false. Can you do it without loops or recursion?
n = 16 → true
n = 5 → false
n = 8 → false (a power of two, but not of four)
n = 1 → true (4^0)Constraints
-2^31 <= n <= 2^31 - 1