Reverse bits of a given 32-bit unsigned integer.
Bitwise Shifting and Masking
To reverse bits of a 32-bit integer, we iterate 32 times. In each step, we shift the result to the left by 1, then we extract the rightmost bit of the input number (`n & 1`) and add it to the result (`res | (n & 1)`). Finally, we shift the input number to the right by 1 (`n >>= 1`). At the end, our result `res` will have the reversed bit sequence.