The clear idea for C++ solution


  • 0
    K

    class Solution {
    public:
    uint32_t reverseBits(uint32_t n) {
    uint32_t count = 0;
    for(int i = 0; i < 32; i++)
    {
    if(n&0x80000000)
    {
    count += 1 << i;
    }
    n = n << 1;
    }
    return count;
    }
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.