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 785e7c3 commit 0a462f4Copy full SHA for 0a462f4
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