231. Power of Two
来源:互联网 发布:组成数据的基本单位 编辑:程序博客网 时间:2024/06/05 14:12
Given an integer, write a function to determine if it is a power of two.
Credits:
Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.
public class Solution { public boolean isPowerOfTwo(int n) { if(n<=0) return false; return (n&(n-1))==0; } }
阅读全文
0 0
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- 231. Power of Two
- HDU 1048字符串格式控制
- 重新分配osd的journal路径
- 免费1G流量外网加速
- JPA Advanced Mappings(映射)
- SVM(Support Vector Machine)
- 231. Power of Two
- 三分板子 zoj 3203
- 线程(从创建到消亡的过程)
- openstack源码解析之虚机创建
- 数据结构之树的创建及非递归遍历
- 交换排序
- RecyclerView添加分割线的简便方法
- ajaxfileupload.js目前功能最全版本(多文件、异常处理等),顺便解决只能上传一次的BUG(非live绑定)
- 一份呕心沥血整理的bug list