Re: [闲聊] 每日leetcode

楼主: DJYOMIYAHINA (通通打死)   2025-08-15 21:58:45
写了一个机八 对不起==
看起来要先判power of 2 再检查是不是奇数位
姆咪
def isPowerOfFour(self, n: int) -> bool:
return False if n<=0 else (n&1431655765)==n and ((n&1431655765)&((n&
1431655765)-1))==0

Links booklink

Contact Us: admin [ a t ] ucptt.com