给定一个整数,编写一个函数来判断它是否是 2 的幂次方。
示例 1: 输入: 1 输出: true 解释: 2^0 = 1
public bool IsPowerOfTwo(int n) { if(n <= 0) return false; return (n & (n-1)) == 0; }