#190. Reverse Bits Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000). 题解:移位运算.…
Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 00111001011110000010100101000000 Explanation: The input binary string 00000010100101000001111010011100 represents the unsigned integer 432615…
public class Solution { public uint reverseBits(uint n) { var list = new List<uint>();//逆序的二进制列表,list[0]是最低位 ) { ; list.Add(cur); n = n / ; } - list.Count; ; i < addzero; i++)//补充到32位 { list.Add(); } list.Reverse(); ; ; i < list.Count; i++) {…