leetcode——190——Reverse Bits
2016-03-29 17:47
387 查看
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).
Follow up:
If this function is called many times, how would you optimize it?
Related problem:
Reverse Integer
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as
00111001011110000010100101000000).
Follow up:
If this function is called many times, how would you optimize it?
Related problem:
Reverse Integer
class Solution { public: uint32_t reverseBits(uint32_t n) { int i,bin=0; for (i = 0; i < 32; i++) bin|=(n >> i & 1)<<(31-i); return bin; } };
相关文章推荐
- nginx_http_proxy_module,实现反向代理及缓存功能
- 内存交换空间(swap)的构建
- 关于此次团队项目中技术选型问题
- Xcode7 使用NSURLSession发送HTTP请求的问题
- java的序列化与反序列化及transient关键字
- 1-100的Catalan数
- javaer to go之基础
- git diff查看差异
- word embedding
- 328-m-Odd Even Linked List
- VM模板学习
- java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
- mysql存储过程笔记
- Mybatis入门例子
- activity间传送bitmap的办法
- <c:forEach>循环list,<c:if>判断奇偶
- Android常见文件路径介绍
- MAC下Eclipse的启动
- eclipse 入门级使用
- 欺壹世充电系列之[Svn集中式版本管理系统] 推荐