每日一题力扣231 啊这

给定一个整数,编写一个函数来判断它是否是 2 的幂次方。

class Solution:
    def isPowerOfTwo(self, n: int) -> bool:
        while n>1:
            n/=2
        return n==1
原文地址:https://www.cnblogs.com/liuxiangyan/p/14510903.html