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