Leetcode 190. Reverse Bits : https://leetcode.com/problems/reverse-bits/
1 |
uint32_t reverseBits(uint32_t n) { |
Tips
- Get the bit at the lowest position of a number n => n & 1 .
- add to the end of the new number, new number should left shift 1, and the original number should right shift 1.
近期评论