LeetCodeOJ_190_Reverse Bits
2015-11-18 21:29
459 查看
答题链接
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
Tags Bit Manipulation
Similar Problems (E) Number of 1 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
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; } };
结果:
总结:
无相关文章推荐
- 摘录 Multiple View Geometry in Computer Vision preface
- 新手必知linux基础知识
- 个人收集的一些库、工具、技术介绍
- it could not find or load the Qt platform plugin "windows"
- iOS MD5加密
- 冒泡排序
- iOS开发:UIImage 图片处理:截图,缩放,设定大小,存储
- Winform Socket通信
- 关于delete 和 new
- java文件过滤器
- hdu 1877 又一版 A+B
- Oracle存储过程中的异常处理
- Velt中的Makefile自动生成
- [Sep 2015 ~ Oct 2015] Deep Learning in arxiv
- OC多态特性详解
- 表单验证
- 视图
- C# id 字符串之类的拼接
- oracle系统包——dbms_job用法(oracle定时任务)
- android:使用网络通信技术从客户端直接获取服务端的对象数据