Leetcode 231 Power of Two 数论

同样是判断数是否是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