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 17b1013 commit ec643aeCopy full SHA for ec643ae
231-power-of-two.py
@@ -0,0 +1,6 @@
1
+# https://leetcode.com/problems/power-of-two/
2
+# https://leetcode.com/problems/power-of-two/discuss/63966/4-different-ways-to-solve-Iterative-Recursive-Bit-operation-Math
3
+
4
+class Solution:
5
+ def isPowerOfTwo(self, n: int) -> bool:
6
+ return n > 0 and (n & (n - 1)) == 0
0 commit comments