(LeetCode 342) Power of Four
来源:互联网 发布:淘宝怎么做活动 编辑:程序博客网 时间:2024/04/30 00:24
Q:
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it without loops/recursion?
solution:
解法很多,思路和之前的方法一样:
(LeetCode 326)Power of Three
(LeetCode 231)Power of Two
判断x是否为整数
class Solution {public: bool isPowerOfFour(int num) { double x = log10(num)/log10(4); if(x==int(x))return true; return false; }};
1 0
- (LeetCode 342) Power of Four
- 【LeetCode-342】Power of Four
- Power of Four leetcode 342
- Leetcode Power of Four 342
- LeetCode 342 Power of Four
- leetcode 342 Power of four
- leetcode 342 Power of Four
- LeetCode[342] Power of Four
- LeetCode 342 Power of Four
- LeetCode 342 Power of Four
- Leetcode 342 Power of Four
- leetcode-342-Power of Four
- Leetcode 342 Power of Four
- [LeetCode]Power of Four
- Power of Four-Leetcode
- LeetCode Power of Four
- LeetCode - Power of Four
- LeetCode:Power of Four
- 位运算----参考极客学院
- Javascript中匿名函数的多种调用方式
- 保证分布式系统数据一致性的6种方案
- Java汉字md5值不一致问题
- HDU 1879 继续畅通工程
- (LeetCode 342) Power of Four
- CentOS 安装和启动nginx
- linux重启oracle数据库方法
- Android studio code template个性化设置
- stm32 IAR环境printf函数调用
- UIEdgeInsets - 1
- Quick-cocos2d-x 组件
- c++获取网卡MAC地址
- 关于iOS多线程,你看我就够了