We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffaabb7 commit 1157c73Copy full SHA for 1157c73
231. Power of Two.py
@@ -0,0 +1,7 @@
1
+class Solution:
2
+ def isPowerOfTwo(self, n: int) -> bool:
3
+ while n > 1:
4
+ if n % 2 != 0:
5
+ return False
6
+ n = n // 2
7
+ return n == 1
0 commit comments