leetcode-Power of Two
来源:互联网 发布:c语言 矩形 rect 编辑:程序博客网 时间:2024/06/09 23:18
只要这个数的最高为1,其他位都为0,则就是2的指数幂。
public class Solution { public boolean isPowerOfTwo(int n) { return (n > 0) && ((n & (n - 1))==0); }}
0 0
- [LeetCode] Power of Two
- 【LeetCode】Power of Two
- [Leetcode]Power of Two
- [leetCode] Power of Two
- leetcode --Power of Two
- leetcode: Power of Two
- LeetCode Power of Two
- [LeetCode] Power of Two
- LeetCode Power of Two
- [leetcode] Power of Two
- [Leetcode]Power of Two
- Leetcode: Power of Two
- [LeetCode]Power of Two
- leetcode | Power of Two
- 【leetcode】Power of Two
- [LeetCode]Power of Two
- [leetcode] Power of two
- LeetCode Power of Two
- 网络虚拟化技术(一): Linux网络虚拟化
- Linux命令整理--pwd命令
- <iOS>swift简单控件的创建
- c++存取dat数据
- FileZilla FTP Server在win2008安装及防火墙设置
- leetcode-Power of Two
- c++单例
- Socket 编程(二)
- View的getScrollX(),getScrollY(),getScrollBy(),getScrollTo()
- android权限大全
- 通过CLLocationManager定位当前坐标和城市
- 欢迎使用CSDN-markdown编辑器
- javascript 的几种使用多行字符串的方式
- C#的textbox的LostFocus事件重复执行