class Solution:
def foo(self, n):
if n <= 0:
return False
if n == 1:
return True
if n % 2 > 0 :
return False
return self.foo(n//2)
def isPowerOfTwo(self, n: int) -> bool:
return self.foo(n)
class Solution:
def isPowerOfTwo(self, n: int) -> bool:
powers_of_two = [2**x for x in range(0, 32)]
if (n in powers_of_two):
return True
return False