Leetcode题解 231. Power of Two
来源:互联网 发布:实战java虚拟机 pdf 编辑:程序博客网 时间:2024/05/08 12:10
Given an integer, write a function to determine if it is a power of two.
没啥说的,很简单的题。
public static boolean isPowerOfTwo(int n) { if (n == 1) { return true; } else if (n <= 0) { return false; } else { while (n > 0) { if (n == 1) { return true; } if (n % 2 == 1) { return false; } n /= 2; } return false; } }
0 0
- Leetcode题解 231. Power of Two
- Leetcode题解 231. Power of Two
- LeetCode题解:Power of Two
- LeetCode题解:Power of Two
- LeetCode 题解(191) : Power of Two
- [leetcode] 231.Power of Two
- LeetCode ||231. Power of Two
- [LeetCode]231.Power of Two
- Leetcode 231. Power of Two
- leetcode 231. Power of Two
- 231. Power of Two LeetCode
- [LeetCode]231. Power of Two
- [LeetCode]231. Power of Two
- LeetCode 231. Power of Two
- [leetcode] 231. Power of Two
- leetcode 231. Power of Two
- LeetCode *** 231. Power of Two
- leetcode 231. Power of Two
- Android Handler中的handleMessage方法和post方法之源码剖析
- sql 连接
- 3的幂--leetcode326
- 福州大学第十二届程序设计竞赛-F - 检查站点
- Android开发常遇问题——Duplicate files copied in APK META-INF/LICENSE.txt(IDE 是 Android studio )
- Leetcode题解 231. Power of Two
- java动态代理
- 小米路由器设置DMZ主机 并在外网访问
- 大话HTML DOM与XML DOM的区别与联系【转】
- SQL 相关子查询例子
- C++之类的六个默认成员函数
- 自我感觉。。第一阶段unity总结。。
- Terminal initialization failed; falling back to unsupported
- 福州大学第十二届程序设计竞赛-G - Escape