342.4的幂
1 = 1
4 = 100
16 = 10000
64 = 1000000mask = 10101010101010101010101010101010class Solution:
def isPowerOfFour(self, n: int) -> bool:
if n <=0 : return False
return (n & (n-1) == 0) and ((n & 0xaaaaaaaa) == 0)最后更新于