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.
2 parents 785e7c3 + 0a462f4 commit 553e9ffCopy full SHA for 553e9ff
231. Power of Two.cpp
@@ -0,0 +1,7 @@
1
+class Solution {
2
+public:
3
+ bool isPowerOfTwo(int n) {
4
+ if (n <= 0) return false;
5
+ return (n & (n - 1)) == 0;
6
+ }
7
+};
0 commit comments