13. Reverse Bits
My Approach
Time and Auxiliary Space Complexity
Code (C++)
class Solution {
public:
long long reversedBits(long long x) {
long long out = 0;
for(int i = 0; i < 31; ++i)
out += x & 1,
out <<= 1,
x >>= 1;
return out;
}
};Contribution and Support
Last updated