leetcode:Reverse Bits

class Solution {
public:
    uint32_t reverseBits(uint32_t n) {
        uint32_t m = 0;
        for(int i=0;i<32;i++)
        {
            m = (m<<1)+(n&0x1);
            n = n>>1;
        }
        return m;
    }
};

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章