[LeetCode] 231. Power of Two
Python
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
if n == 0:
return False
while n != 1:
if n % 2 != 0:
return False
else:
n /= 2
return True
댓글남기기