public class Solution {
public bool IsPowerOfFour(int num) {
return (num > ) && ((num & (num - )) == ) && ((num & 0x55555555) == num);
}
}

https://leetcode.com/problems/power-of-four/#/description

leetcode342的更多相关文章

  1. 每天一道LeetCode--342. Power of Four

    Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Giv ...

  2. leetcode342——Power of Four(C++)

    Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Giv ...

  3. leetcode342合理运用位操作判断4的幂

    Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Gi ...

  4. [Swift]LeetCode342. 4的幂 | Power of Four

    Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: ...

  5. LeetCode-342:Power of Four

    This  is another  "Pick One" Problem :[Problem:342-Power of Four] Given an integer (signed ...

  6. leetcode231 2的幂 leetcode342 4的幂 leetcode326 3的幂

    1.2的幂 正确写法: class Solution { public: bool isPowerOfTwo(int n) { ) return false; )) == ; } }; 错误写法1: ...

  7. LeetCode191 Number of 1 Bits. LeetCode231 Power of Two. LeetCode342 Power of Four

    位运算相关 三道题 231. Power of Two Given an integer, write a function to determine if it is a power of two. ...

  8. LeetCode 342

    Power of Four Given an integer (signed 32 bits), write a function to check whether it is a power of ...

随机推荐

  1. dfs 与 剪枝

    http://blog.csdn.net/u010700335/article/details/44095171

  2. hdu 2063 二分图匹配

    题意:一些女的和一些男的有好感,有好感的能一起坐过山车,问最多能组成多少对 hdu 11 页上少有的算法题,二分图匹配问题,匈牙利算法,对于每一个汉子,看和他有好感的妹子有没有配对了,没有配对过就可以 ...

  3. LG2945 【[USACO09MAR]沙堡Sand Castle】

    经典的贪心模型,常规思路:将M和B排序即可 看到没有人用优先队列,于是我的showtime到了 说下思路: 读入时将数加入啊a,b堆中,不用处理(二叉堆本来就有有序的性质) 读完后逐个判断,照题目模拟 ...

  4. nexus && minio s3 存储私有镜像

    对于新版本的nexus 已经支持s3 存储了(3.12),但是企业内部可能还是需要使用私有部署的 还好我们有minio,具体的介绍就不说了 minio 项目运行 参考项目: https://githu ...

  5. mysql 如何选择随机行

    最简单的方式是使用 mysql 的 ORDER BY RAND() 子句. SELECT  col1  FROM  tbl  ORDER  BY  RAND()  LIMIT  10; 它能很好的运行 ...

  6. 转 微软Sysinternals Suite工具13年12月版下载

    Sysinternals Suite 是微软出品的一套集成数十个绿色软件的系统工具包.Sysinternals Suite 和IT之家的魔方电脑大师设计一样,里面的各个小工具组件都可以单独拿出来运行, ...

  7. 读写XML文档时,去掉新增加节点的“空命名空间”(xmlns=””)

    在做对ReprotViewer编程时,想做一个用户可以更改显示/打印列的功能,大致看了下,只需要通过对rdlc文件中改变其<Hidden>节点值为false/true,即可实现对应某列的显 ...

  8. centos7 取消自动锁屏

    CentOS7默认短时间会锁屏,这带来了一定的麻烦,比如看电影时,你不得不时不时的动动鼠标,才能防止锁屏.在网上查了一些资料,也没有找到相关的解决办法,不过最终还是找到了. 1.打开 applicat ...

  9. bzoj1799(洛谷4127)同类分布(月之谜)

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1799 https://www.luogu.org/problemnew/show/P4127 ...

  10. SVN同步

    SVN同步:1.在备份服务器上安装SVN,之后创建同名的库名2.在备机的Repositories的库文件夹下的hooks目录下,备份并修改pre-revprop-change.tmpl文件为pre-r ...