Description
Given an integer n, return true if it is a power of four. A number is a power of four if it can be expressed as 4^k for some non-negative integer k. Otherwise, return false.
Examples
Input:
n = 16Output:
trueExplanation:
16 = 4².
Input:
n = 5Output:
falseExplanation:
The final result is false because 5 cannot be written as 4^k for any non-negative integer k.
Input:
n = 64Output:
trueExplanation:
64 = 4³, so it is a power of four.
Constraints
- •
-2³¹ ≤ n ≤ 2³¹ - 1