190. Reverse Bits 發表於 2023-02-13 | 分類於 leetcode problemsolution利用 >>i 取得第i位元 1234567891011class Solution {public: uint32_t reverseBits(uint32_t n) { uint32_t ret = 0; for(int i=0;i<32;++i){ ret<<=1; ret += (n>>i)&1; } return ret; }}; analysis time complexity O(1) space complexity O(1)