3 line in C++


  • 0
    T

    class Solution {
    public:
    uint32_t reverseBits(uint32_t n) {

       string binary = std::bitset<32>(n).to_string();
       reverse(binary.begin(), binary.end());
       return bitset<32>(binary).to_ulong();
    
    }
    

    };


Log in to reply
 

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