请使用一个表达式语句,用于判断一个数是不是 2 的幂。解析:本题考核两个方面:1.负数完备性考虑。 2.位运算技巧, n = n & (n-1) 的效果是消除 n 的最后一个 1 位。n > 0 ? (n & (n-1)) == 0 : false; Last modification:July 26, 2020 © Allow specification reprint Support Appreciate the author Like 如果觉得我的文章对你有用,请随意赞赏