[leetcode]231. Power of Two
2016-03-18 17:01
239 查看
231. Power of Two
Total Accepted: 62182 Total Submissions: 173791 Difficulty: Easy
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.
Subscribe to see which companies asked this question
class Solution { public: bool isPowerOfTwo(int n) { return (n>0)&&((n&(n-1))==0); } };
相关文章推荐
- 代码规范
- lintcode: 堆化
- MySQL基本操作总结
- MinGW-GCC 如何编译JNI程序进阶
- Yii rules常用规则
- Git服务搭建及SSH密钥使用过程中遇到的坑
- Zookeeper
- Android中的Selector的用法
- Floating
- bzoj4037: [HAOI2015]Str
- Android 基础动画(原创)
- 俄罗斯方块代码
- Django返回Json
- NSDictionary&NSMutableDictionary常用操作
- 87. 考前复习(动态规划)
- C++简易
- kvm大神写的搭建教程
- JDK各个版本的新特性jdk1.5-jdk8
- jvm
- 使用友盟分享的步骤