class Solution {
public:
bool isPowerOfTwo(int n) {
if(n <= 0)
return false;
return !(n&(n-1));
}
};
LeetCode ||231. Power of Two
最新推荐文章于 2023-12-16 11:57:26 发布
class Solution {
public:
bool isPowerOfTwo(int n) {
if(n <= 0)
return false;
return !(n&(n-1));
}
};