[LeedCode OJ]#231 Power of Two
来源:互联网 发布:origin作图软件官网 编辑:程序博客网 时间:2024/06/07 00:19
【 声明:版权所有,转载请标明出处,请勿用于商业用途。 联系信箱:libin493073668@sina.com】
题目链接:https://leetcode.com/problems/power-of-two/
题意:
判断一个数是否2^n
思路:
循环进行位移操作
class Solution{public: bool isPowerOfTwo(int n) { for(int i = 0;; i++) { if((1LL<<i)>n) return false; if((1LL<<i)==n) return true; } }};
0 0
- [LeedCode OJ]#231 Power of Two
- [leetcode oj 231]Power of Two
- <LeetCode OJ> 231 / 342 Power of (Two / Four)
- [LeedCode OJ]#160 Intersection of Two Linked Lists
- 231Power of Two
- 231 Power of Two
- 231Power of Two
- 231 - power of two
- 231Power of Two
- 231 Power of Two
- 231:Power of Two
- [231]Power of Two
- 231 Power of Two
- Power of Two---231
- [231] Power of Two
- leetcode-231 Power of Two
- leetcode 231:Power of Two
- LeetCode 231: Power of Two
- Linux软连接和硬链接
- Spring Security + Hibernate XML Example
- js 毫秒 转date
- hessian spring 调用
- Caliburn Micro Part 5: The Window Manager
- [LeedCode OJ]#231 Power of Two
- Android 打包签名(一)
- Iphone程序运行流程
- hdu 4585 set + pair
- jquery核心基础
- linux下升级pip安装不了第三方库的解决方法
- hdu 1525 Euclid's Game
- hdoj 5137 How Many Maos Does the Guanxi Worth 【最短路 + 删点】
- Undefined symbols for architecture i386:和"_OBJC_CLASS_$_xx", referenced from:问题解决方法