We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
给定一个整数,编写一个函数来判断它是否是 2 的幂次方。
示例 1:
输入: 1 输出: true 解释: 2^0 = 1
示例 2:
输入: 16 输出: true 解释: 2^4 = 16
示例 3:
输入: 218 输出: false
function isPowerOfTwo(num) { return num > 0 && (n & (n - 1)) == 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
给定一个整数,编写一个函数来判断它是否是 2 的幂次方。
示例 1:
示例 2:
示例 3:
解答
The text was updated successfully, but these errors were encountered: