反转二进制

 class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t ans = ;
for (int i = ; i<; ++i,n >>=){
ans = (ans<< )|(n & );
}
return ans;
}
};

Leetcode 190 Reverse Bits 位运算的更多相关文章

  1. LeetCode 190. Reverse Bits (算32次即可)

    题目: 190. Reverse Bits Reverse bits of a given 32 bits unsigned integer. For example, given input 432 ...

  2. [LeetCode] 190. Reverse Bits 颠倒二进制位

    Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 ...

  3. [LeetCode] 190. Reverse Bits 翻转二进制位

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...

  4. LeetCode 190. Reverse Bits (反转位)

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...

  5. Java for LeetCode 190 Reverse Bits

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...

  6. Leetcode 190. Reverse Bits(反转比特数)

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...

  7. Java [Leetcode 190]Reverse Bits

    题目描述: everse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represente ...

  8. 【LeetCode】190. Reverse Bits 解题报告(Python & C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 解题方法 二进制字符串翻转 位运算 日期 题目地址:https://le ...

  9. 【LeetCode】190. Reverse Bits

    题目: Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented ...

随机推荐

  1. android之RadioGroup

    radioGroup这控件在开发中也是常用到的 RadioGroup 有时候比较有用.主要特征是给用户提供多选一机制. 用微信举一个例子吧! <?xml version="1.0&qu ...

  2. PHP--目录处理

    __file___ dirname(): dirname()与__file__的组合:dirname(__file__)

  3. unreal3脚本stacktrace的问题

    在unrealscript里获取调用栈,有下面两函数: /** * Dumps the current script function stack to the log file, useful * ...

  4. centos6搭建VPN

    1,检查是否开启PPP #cat /dev/ppp cat: /dev/ppp: No such device or address //表示已经开启 2,安装ppp和iptables #yum in ...

  5. Int16, Int32, Int64 范围

    Int16, 等于short, 占2个字节. -32768 32767 Int32, 等于int, 占4个字节. -2147483648 2147483647 Int64, 等于long, 占8个字节 ...

  6. iOS获取通讯录 电话号码与姓名

    // 还是导入 #import <AddressBook/AddressBook.h> - (void)fetchAddressBookBeforeIOS9{ ABAddressBookR ...

  7. 一个使用方便的对FMDB进行封装的框架和一个可以切应用图标的应用

    框架的git地址 :https://github.com/Joker-King/JKDBModel 切割图标的应用地址 http://pan.baidu.com/s/1kVjflwr

  8. JavaScript 设计模式 - 工具函数

    1.类式继承,模拟面向对象语言的继承方式 function extend(subClass, superClass) { var F = function() {}; F.prototype = su ...

  9. 【转】Android 当打开“开发者模式”中的“不保留活动”后,程序应当怎么保持正常运行

    当打开这个设置以后,程序的Activity会自动销毁,每次返回的时候就会不断重oncreate,此时伴随的问题多多. 参考文档:http://www.bubuko.com/infodetail-960 ...

  10. day4----json的简单实用

    json官方说明参见:http://json.org/ Python操作json的标准api库参考:http://docs.python.org/library/json.html 重要函数 编码:把 ...