Skip to content

Commit 553e9ff

Browse files
authored
Merge pull request SjxSubham#245 from Subhosjx/patch-3
231. Power of Two
2 parents 785e7c3 + 0a462f4 commit 553e9ff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

231. Power of Two.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)