InferenceAI

Enter at least two characters to search.

Start free

Reverse 32 Bits

easyBit Manipulation15 min10 XP

Return the unsigned 32-bit integer whose binary representation is n's 32 bits in reverse order.

Examples

EXAMPLE WALKTHROUGHclassic

A guided view of the published example, not a trace of your code.

INPUT[43261596]
TASKreverse_bits_32()
EXPECTED OUTPUT964176192

Start with the input values shown in this example.

Example 1 of 3

Input: n = 43261596

Output: 964176192

Explanation: classic

Input: n = 4294967293

Output: 3221225471

Explanation: high bits

Input: n = 0

Output: 0

Explanation: zero

Hint 1

Shift the result left and add n & 1, then shift n right, 32 times.

Topics

DSABit ManipulationPython