1、题目描述

2、题目分析

使用bitset 类的方法

3、代码

 uint32_t reverseBits(uint32_t n) {
bitset<> b(n); string b_s = b.to_string() ; for( string::iterator it_b = b_s.begin() , it_e = b_s.end() - ; it_b < it_e ; ++it_b ,--it_e ){
swap(*it_b ,*it_e);
} bitset<> br( b_s ) ; uint32_t nr = (uint32_t) br.to_ulong() ;
return nr; }

LeetCode题解之Reverse Bits的更多相关文章

  1. 【一天一道Leetcode】#190.Reverse Bits

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 我的个人博客已创建,欢迎大家持续关注! 一天一道le ...

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

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

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

  5. LeetCode OJ:Reverse Bits(旋转bit位)

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

  6. LeetCode 192:Reverse Bits

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

  7. 【刷题-LeetCode】190 Reverse Bits

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

  8. LeetCode算法题-Reverse Bits(Java实现)

    这是悦乐书的第185次更新,第187篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第44题(顺位题号是190).给定32位无符号整数,求它的反转位.例如: 输入:4326 ...

  9. leetcode题解 7.Reverse Integer

    题目: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 E ...

随机推荐

  1. 在Mac OS X上启用Apache和PHP

    因为Mac OS X上都已自带了Apache和PHP,所以都无需进行安装,只要按照自己的需要进行设置即可. 找到httpd.conf文件,并用编辑器打开. 加载PHP模块.找到 #LoadModule ...

  2. Oracle中的层次查询详解

    1 语法格式 select [level], column, expr... from table [where condition] start with condition connect by ...

  3. Windows 8.1 硬盘安装 Ubuntu14.04 双系统参考教程及注意事项

    硬盘安装,无需光盘.U盘:Win8.1为主,Ubuntu14.04为辅,可将Windows或Ubuntu设置为开机默认启动项:在Ubuntu下可查看.操作Windows系统下的文件:适用于安装和14. ...

  4. 忽略“Signal: SIGSEGV (Segmentation fault)”

    1. touch ~/.gdbinit 2. 在.gdbinit文件中添加“handle SIGSEGV nostop noprint pass”

  5. 15-hadoop-eclipse插件的安装

    好久没更新了, 也好久没学了, 今天换了个eclipse版本, 安装插件坑了一会, 果然好记性不如烂笔头, 记下来吧 编译安装或者直接安装都可以, 先说下编译安装吧 1, 编译安装, 是使用的ant, ...

  6. 链式编程:遇到多个构造器参数(Constructor Parameters)时要考虑用构建器(Builder)

    public class NutritionFacts { private final int servingSize; private final int servings; private fin ...

  7. vue 2.x之组件的数据传递(一)

    这是根据官方提供的脚手架vue-cli搭建,通过简单的案例来介绍vue数据的传递的方式,根据自己平时用到的,来做简单的总结: 1.父组件传递数据给子组件 父组件传递数据给子组件,需要把子组件引入,并挂 ...

  8. .Net调用Java端带有WS-Security支持的Web Service【亲测通过】

    做了几年的开发,今天终于鼓起勇气开通了博客园.平时都是找各种大牛,看他们的分享博客的解决BUG.从今天起,我也开始分享我学习之路.还望大家多多支持! 最近收到一个采用Axis2实现的WebServic ...

  9. 【转】Navicat Premium 12破解方法

    来源网址:https://www.jianshu.com/p/42a33b0dda9c 1.按步骤安装Navicat Premium,如果没有可以去官网下载:http://www.navicat.co ...

  10. javascript正则表达式获取控制

    正则表达式的元字符是包含特殊含义的字符,他们有一些特殊的功能,可以控制匹配模式的方式,反斜杠后的元字符将失去其特殊含义 单个字符 元字符 匹配情况 . 匹配除换行符外的任意字符 [a-z0-9] 匹配 ...