leedcode-4的幂
自己写的,如果n对4可以整除。就让n除以4,循环往复
class Solution: def isPowerOfFour(self, n: int) -> bool: while n%4==0 and n>0: n//=4 return n==1
自己写的,如果n对4可以整除。就让n除以4,循环往复
class Solution: def isPowerOfFour(self, n: int) -> bool: while n%4==0 and n>0: n//=4 return n==1