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 = 16
Output:true
Explanation:

16 = 4².

Input:n = 5
Output:false
Explanation:

5 is not a power of four. Powers of four are 1, 4, 16, 64, ...

Input:n = 64
Output:true
Explanation:

64 = 4³, so it is a power of four.

Constraints

  • -2³¹ ≤ n ≤ 2³¹ - 1

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!