LeetCode 🏔️/Binary

190. Reverse Bits

KB0129 2023. 5. 24. 04:14

Today, I solved "Reverse Bits."

Description:

https://leetcode.com/problems/reverse-bits/description/

 

In this problem, we are gonna do reverse order of 32-bits number.

Solution:

"output" will store "0" or "1." If the bit number is 1, then the output store 1 in it. 

Otherwise, it stores 0. 

 

In output, we shift the bit left, and also we shift the bit right in n.