Skip to content

Commit 8b1c5e3

Browse files
committed
#234 solution
1 parent 17c09df commit 8b1c5e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

reverse-bits/sungjinwi.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <stdint.h>
2+
3+
class Solution {
4+
public:
5+
uint32_t reverseBits(uint32_t n) {
6+
uint32_t ans = 0;
7+
8+
for (int i = 0; i < 32; i++) {
9+
ans <<= 1;
10+
ans += n & 1;
11+
n >>= 1;
12+
}
13+
return ans;
14+
}
15+
};

0 commit comments

Comments
 (0)