leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0190.cpp (234B)


      1 class Solution {
      2   public:
      3     uint32_t reverseBits(uint32_t n) {
      4         int count = 32, res = 0;
      5         while (count--) {
      6             res <<= 1;
      7             res += n & 1;
      8             n >>= 1;
      9         }
     10         return res;
     11     }
     12 };