LeetCode *** 342. Power of Four
来源:互联网 发布:mac隐藏磁盘分区 编辑:程序博客网 时间:2024/06/05 17:48
题目:
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?
分析:
。
代码:
class Solution {public: bool isPowerOfFour(int num) { return num>0&&!(num&(num-1))&&!((num-1)%3); }};
0 0
- 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
- 342.[leetcode]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
- Restore IP Addresses
- 异常:Binary XML file line #7: Error inflating class android.support.v7.widget.RecyclerView
- 某驱动的内核调试检测学习内核调试引擎加载机制
- 雷达简介:原理、组成与分类
- Groovy入门(四)——集合Map
- LeetCode *** 342. Power of Four
- 动态添加碎片主要分为5步
- Trapping Rain Water
- android适配规则(一)
- Agri-Net(POJ_1258)
- mac alias 添加 sublime 快捷键
- .NET Business Connector mode assembly is built against version 'v2.0.50727' of the runtime
- 无限极分类
- python进程写文件与多进程记录日志