#include #include #include int main() { //Reverse bits of an unsigned 32 bit integer std::cout << reverse_bits(43261596) << std::endl; return 0; } uint32_t reverse_bits(uint32_t n) { uint32_t result = 0; // Starting from the end of the bit string, traverse backwards for (int i = 31; i >= 0; i--) { result |= (n & 1) << i; // Bitwise OR assign the n >>= 1; } return result; }