Skip to content

Commit

Permalink
Time: 6 ms (15.71%), Space: 6 MB (25.63%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
IC1101Virgo committed May 20, 2022
1 parent a81d13e commit 4427b63
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 231-power-of-two/231-power-of-two.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution {
public:
bool isPowerOfTwo(int n) {
if(n==0)
return 0;
if(floor(log2(n))==ceil(log2(n)))
return 1;
else
return 0;
}
};

0 comments on commit 4427b63

Please sign in to comment.