190. Reverse Bits

来源:互联网 发布:apache官方下载32位 编辑:程序博客网 时间:2024/06/12 20:33
class Solution {public:    uint32_t ans = 0;    uint32_t reverseBits(uint32_t n) {                for(int i = 0; i < 32; ++i){            if(n & (1 << i)){                ans |= (1 << (32 - i - 1));            }        }        return ans;    }};

原创粉丝点击