Given an integer, write a function to determine if it is a power of two. 题解:一次一次除2来做的话,效率低.所以使用位运算的方法(左移一位相当于原数乘2)列出在int范围内的所有2的倍数,然后和n异或如果等于0,那么n就是它(两个数的异或为0,那么两个数就相等). 注意:位运算的优先级比==的优先级低,要加括弧. class Solution { public: bool isPowerOfTwo(int n) { ; )…