Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Reverse Bits

Easy
bit-manipulation

Given the 32-bit binary representation of an unsigned integer, reverse the bits and return the resulting unsigned integer value.

Input: one line — a 32-character binary string. Output: the decimal value after reversal.

Example 1
Input:
00000010100101000001111010011100
Output:
964176192

Reversed: 00111001011110000010100101000000₂.

Example 2
Input:
11111111111111111111111111111101
Output:
3221225471

Constraints

  • The input is exactly 32 binary digits.
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.