Skip to content

Commit 920ff50

Browse files
committed
Time: 51 ms (43.17%), Space: 16.1 MB (93.69%) - LeetHub
1 parent 1ef047f commit 920ff50

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def isPowerOfTwo(self, n: int) -> bool:
3+
while n:
4+
if n == 1:
5+
return True
6+
elif n % 2 == 0:
7+
n /= 2
8+
else:
9+
return False

0 commit comments

Comments
 (0)