Reverse Bits Problem

Reverse Bits Problem — ExecCode Easy DSA Practice

Solve the Reverse Bits problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Reverse the bits of a given 32-bit unsigned integer and return the resulting unsigned 32-bit integer, processing one bit at a time from least to most significant.

Examples

Input n = 43261596; Output 964176192. Input n = 4294967293; Output 3221225471. Input n = 1; Output 2147483648

Constraints

The input is a 32-bit unsigned integer Output must also be treated as unsigned

Practice Reverse Bits free on ExecCode. Browse DSA problems, topic map, and placement guides.