diff --git a/Power of Two.py b/Power of Two.py new file mode 100644 index 000000000..c665b43a9 --- /dev/null +++ b/Power of Two.py @@ -0,0 +1,8 @@ +class Solution: + def isPowerOfTwo(self, n: int) -> bool: + while n%2==0: + n//=2 + if n==1: + return True + else: + return False