Reverse Bits

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

Credits:
Special thanks to @ts for adding this problem and creating all test cases.
 
 class Solution
{
public:
uint32_t reverseBits(uint32_t n)
{
int A[] = {};
int i = ;
while(n > )
{
A[i++] = n % ;
n /= ;
} int sum = ;
for(i = ; i < ; i++)
sum = sum * + A[i]; return sum;
}
};

最新文章

  1. Mysql学习笔记(四)聊聊数据库索引
  2. 架构模式对象与关系结构模式之:标识域(Identity Field)
  3. oracle 查询当前库中所有表以及某表字段信息
  4. 解决 Tomcat 无法绑定 80 端口的问题,以及 Tomcat 配置虚拟目录、二级域名等
  5. 支付宝支付集成,上传RSA公钥一直显示格式错误
  6. C++ vector和list的区别
  7. hdu 4635 Strongly connected(强连通)
  8. 接入新浪、腾讯微博和人人网的Android客户端实例 接入新浪、腾讯微博和人人网的Android客户端实例
  9. plsql中文乱码问题(显示问号)
  10. js 发送ajax请求(XMLHttpRequest)
  11. 奔五的人,准备学习iOS开发
  12. ORA-01940无法删除当前已连接用户
  13. VS2010 C#调用C++ DLL文件
  14. Linux基础学习笔记以及常用命令
  15. iozone测试磁盘性能
  16. python中两种方法实现二分法查找,细致分析二分法查找算法
  17. ionic2中使用datetime组件如何默认设置当前时间?
  18. Kali学习笔记26:OWASP_ZAP
  19. 面试知识点——Java
  20. 面试小结之Elasticsearch篇(转)

热门文章

  1. 未能找到类型或命名空间名称“Coco”(是否缺少 using 指令或程序集引用)
  2. ionic 添加应用图标与启动页
  3. bootstrap插件学习-bootstrap.button.js
  4. 受限玻尔兹曼机(RBM)学习笔记(五)梯度计算公式
  5. Device.js – 快速检测平台、操作系统和方向信息
  6. EL表达式经典用法
  7. ChartDirector应用笔记(二)
  8. c#通用递归生成无限层级树
  9. 【Unity】12.5 Navmesh Obstacle组件
  10. LeetCode129:Sum Root to Leaf Numbers