dsa · easy

Power of Four

Return whether n is a positive power of four (1, 4, 16, 64, …).

Arguments

Example

n = 16true. n = 5false. n = 1true.

Constraints

-2^31 <= n <= 2^31 - 1 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
16

Expected:
true

Example 2

Input:
5

Expected:
false

Example 3

Input:
1

Expected:
true

Open in the Dojo editor