Given an integer, write a function to determine if it is a power of two.
class Solution { public: bool isPowerOfTwo(int n) { long long int m = n; return n==0 ? false : (m&(m-1))==0; } };
Next challenges: (M) Bitwise AND of Numbers Range (M) Perfect Squares (H) Best Meeting Point
原文:http://www.cnblogs.com/zengzy/p/5052349.html