Description Using O(1) time to check whether an integer n is a power of 2. Example For n=4, return true; For n=5, return false; Challenge O(1) time 题解:题目要求判断一个数是不是2的幂次方,并且规定时间复杂度为线性级.那么,就不能用常规的循环求解思路去解题了,之前做过一个不用加号求两数之和的题目.这两个题目有点类似,可以通过位运算来快速求解.先考虑这…