We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1944e7c commit eb1aeccCopy full SHA for eb1aecc
Power of two
@@ -0,0 +1,9 @@
1
+class Solution {
2
+public:
3
+ bool isPowerOfTwo(int n)
4
+ {
5
+ if(n<=0)
6
+ return false;
7
+ return n && (!(n & (n-1)));
8
+ }
9
+};
0 commit comments