Leetcode 231 Power of Two
Leetcode 231 Power of Two#include <math.h>using namespace std;class Solution {public: bool isPowerOfTwo(int n) { //如果n&(n-1)是0,则n是2的n次方 if ((n &(n - 1) )== 0 && n > 0)//要把n&(n-1)再