power_is_two
power_is_two.py 源码
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
return n != 0 and n & (n - 1) == 0
你可能感兴趣的文章
0
赞