## 题目:

Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).
If this function is called many times, how would you optimize it?

Related problem Reverse Integer
Tags Bit Manipulation
Similar Problems (E) Number of 1 Bits

## 代码：

class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t m=0;
for(int i=0;i<32;i++)
{
m=m*2+n%2;
n=n/2;
}
return m;
}
};

## 总结：

#### UVA_446_Kibbles "n" Bits "n" Bits "n" Bits

2016-04-19 11:44:04

#### UVa 446 - Kibbles "n" Bits "n" Bits "n" Bits

2014-05-04 15:28:12

#### C++中<bits/stdc++.h>说明

2017-06-05 21:07:31

#### 高级c++头文件bits/stdc++.h

2016-05-02 16:46:00

#### 在VS中使用#include <bits/stdc++.h>的方法

2017-02-22 23:49:07

#### 在 OS X 中安裝 GNU GCC 以及使用 bits/stdc++.h 头文件 Policy-Based Data Structure

2016-05-23 16:41:43

#### 程序员们梦寐以求的头文件 <bits/stdc++.h>

2014-09-03 21:44:07

#### #include<bits/stdc++.h>包含C++的所有头文件

2014-04-28 14:18:42

#### 在编程竞赛中使用<bits/stdc++.h>

2014-12-17 11:28:05

#### bits/c++config.h找不到

2017-01-07 15:16:32

## 不良信息举报

LeetCodeOJ_190_Reverse Bits