Most Simple C# Solution


  • 1
    K
    public class Solution {
        public uint reverseBits(uint n)
        {
            uint num = 0;
            for(int i = 0; i < 32; ++i){
                num <<= 1;
                num += n % 2;
                n >>= 1;
            }
            return num;
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.