题目链接
class Solution {
public boolean isPowerOfTwo(int n) {
if(n<=0) return false;
//8的二进制1000 7的二进制0111 做个与操作结果为零
if((n&n-1)==0) return true;
else return false;
}
}
标签:int,Solution,No.41,boolean,isPowerOfTwo,腾讯,public,五十
来源: https://www.cnblogs.com/jianjiana/p/15874990.html