很简单的位运算题目
class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t ans;
int pos = 0;
while(pos<=31)
{
ans <<= 1;
ans |= (n&1);
n >>=1;
pos++;
}
return ans;
}
};
LeetCode 190. Reverse Bits (位运算)
原文:https://www.cnblogs.com/dacc123/p/12295889.html