Skip to content

Commit 0bc31fe

Browse files
committed
Add reverse bits Solution - s0ooo0k
1 parent 52b285e commit 0bc31fe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

reverse-bits/s0ooo0k.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int reverseBits(int n) {
3+
int result = 0;
4+
for(int i = 0; i < 32; i++) {
5+
result <<= 1;
6+
result |= (n & 1);
7+
n >>>= 1;
8+
}
9+
return result;
10+
}
11+
}
12+

0 commit comments

Comments
 (0)