同样是判断数是否是2的n次幂,同 Power of three
1 class Solution { 2 public: 3 bool isPowerOfTwo(int n) { 4 return (n > 0) && (((long long)1<<31) % n == 0); 5 } 6 };
同样是判断数是否是2的n次幂,同 Power of three
1 class Solution { 2 public: 3 bool isPowerOfTwo(int n) { 4 return (n > 0) && (((long long)1<<31) % n == 0); 5 } 6 };
转载于:https://www.cnblogs.com/onlyac/p/5231480.html