Easy-题目43:190. Reverse Bits
来源:互联网 发布:边际递减效应爱情知乎 编辑:程序博客网 时间:2024/06/08 00:55
题目原文:
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).
题目大意:
对一个32位的无符号整数,翻转它的比特位。
题目分析:
用一个新数t从0开始记录n的最后一位,然后令n右移,t左移。
源码:(language:c)
uint32_t reverseBits(uint32_t n) { int t=0; for(int i=0;i<32;i++) { t=t*2+n%2; n/=2; } return t;}
成绩:
4ms,beats 10.63%,众数4ms,89.37%
0 0
- Easy-题目43:190. Reverse Bits
- 190. Reverse Bits [easy] (Python)
- Leetcode 190. Reverse Bits (Easy) (cpp)
- [Leetcode 190, Easy] Reverse Bits
- 【LeetCode】190.Reverse bits
- LeetCode 190. Reverse Bits
- 190. Reverse Bits
- Leetcode 190. Reverse Bits
- 190. Reverse Bits LeetCode
- 190. Reverse Bits
- 190. Reverse Bits
- 190. Reverse Bits
- LeetCode *** 190. Reverse Bits
- 190. Reverse Bits
- 190. Reverse Bits
- LeetCode 190. Reverse Bits
- 190. Reverse Bits
- 190. Reverse Bits
- JQuery选择器中的子元素选择器
- Jsoup解析html的基本用法
- 1054. The Dominant Color (20)
- 使用Hadoop Streaming Image进行图像分类 classification with Hadoop Streaming
- ssl例6(未完成)
- Easy-题目43:190. Reverse Bits
- 【HDU】 1397 Goldbach's Conjecture
- 数据结构-线性表
- maven整合spring+springMvc+Mybatis+Mysql
- 让爬虫更加友好
- C++生成随机数
- Easy-题目44:19. Remove Nth Node From End of List
- 客户端调用服务端接口减少请求数据容量的优化例子
- 安卓小案例收集二