Power of Four
Powers of four go 1, 4, 16, 64, and so on. Given an integer n, check whether it can be written as 4^k, where k is a non-negative integer. Return True if it can, otherwise return False.
Примеры
Ввод
16Вывод
TrueВвод
5Вывод
FalseВвод
1Вывод
TrueНужно реализовать
def is_power_of_four(n: int) -> bool:
Теги
math
Prisijunkite, kad matytumėte pateikimų istoriją
PrisijungtiPrisijunkite, kad naudotumėte DI mentorių
PrisijungtiVisible tests
1
Input
16Expected
True2
Input
5Expected
False3
Input
1Expected
True4
Input
64Expected
True5
Input
0Expected
False6
Input
2Expected
FalseFocus radio
Paused · SomaFM · Fluid