标签:
1 class Solution { 2 public: 3 /* 4 * @param n: An integer 5 * @return: True or false 6 */ 7 bool checkPowerOf2(int n) { 8 // write your code here 9 return n > 0 && ((n & (n - 1)) == 0); 10 } 11 };
标签:
原文地址:http://www.cnblogs.com/jcliBlogger/p/4612213.html