Skip to content

Commit 5ce5865

Browse files
refactor 190
1 parent 43a2477 commit 5ce5865

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+2
-2
lines changed

src/main/java/com/fishercoder/solutions/_190.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public int reverseBits(int n) {
2626
for (int i = 0; i < 32; i++) {
2727
res += n & 1;//get the most right bit each time
2828
n >>>= 1;//do UN-signed right shift by 1 each time
29+
//n >>= 1;//this line works as well on LeetCode OJ, choosing either one works
2930
if (i < 31) {
30-
res <<=
31-
1;//shift this number to the left by 1 each time, so that eventually, this number is reversed
31+
res <<= 1;//shift this number to the left by 1 each time, so that eventually, this number is reversed
3232
}
3333
}
3434
return res;

0 commit comments

Comments
 (0)