class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t temp = 1, bit = 1, ans = 0;
bit <<= 31;
while(bit) {
if(n & bit) ans += temp;
temp <<= 1;
bit >>= 1;
}
return ans;
}
};
【leetcode 位运算 C++】190. Reverse Bits
猜你喜欢
转载自blog.csdn.net/m0_37454852/article/details/113935933
今日推荐
周排行