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. hdu2088

    hdu2088 #include<stdio.h> #include<algorithm> using namespace std; ]; int main(){ ; ){ , ...

  2. LG1955 [NOI2015]程序自动分析

    题意 题目描述 在实现程序自动分析的过程中,常常需要判定一些约束条件是否能被同时满足. 考虑一个约束满足问题的简化版本:假设x1,x2,x3...代表程序中出现的变量,给定n个形如xi=xj或xi≠x ...

  3. TCC(Tiny C Compiler)介绍

    TCC是一个超小.超快的标准C语言编译器.她可以从这里(http://bellard.org/tcc/)下载到:注意,要下载http://download.savannah.nongnu.org/re ...

  4. javacv 340使用 人脸检测例子【转载】

    Java下使用opencv进行人脸检测 工作需要,研究下人脸识别,发现opencv比较常用,尽管能检测人脸,但识别率不高,多数是用来获取摄像头的视频流的,提取里面的视频帧,实现人脸识别时通常会和其他框 ...

  5. <dedecms>织梦内页调用会员信息

    1.织梦CMS v5.7调用文章所属会员信息标签 打开官方默认模板article_artcile.htm,我们可以提取出如下代码:  {dede:memberinfos}   会员头像:<a h ...

  6. linux下syscall函数 间接系统调用

    NAME              syscall - 间接系统调用 SYNOPSIS              #define _GNU_SOURCE               #include ...

  7. POSIX 消息队列 之 参数说明

    消息队列 一.函数 mq_open 头文件 mqueue.h: 原型 mqd_t mq_open(const char *name, int oflag, .../*mode_t mode,struc ...

  8. [OI向?] ubuntu下一些常用的技巧

    想起来什么就写什么吧. Ubuntu下的对拍程序 python是最为简便的. from os import system while True: system("./make > in ...

  9. VBA改写VBA代码

    问题源自:Excel 一个困扰我很长时间的代码转换问题-Word-ExcelHome技术论坛 -  http://club.excelhome.net/thread-1334942-1-1.html ...

  10. linux下maven项目clean失败

    今天在linux下创建了一个项目自动化发布的脚本,在执行到 mvn clean package -Dmaven.test.skip=true 的时候,项目clean失败 查下下度娘,windows下导 ...