We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43a2477 commit 5ce5865Copy full SHA for 5ce5865
src/main/java/com/fishercoder/solutions/_190.java
@@ -26,9 +26,9 @@ public int reverseBits(int n) {
26
for (int i = 0; i < 32; i++) {
27
res += n & 1;//get the most right bit each time
28
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
30
if (i < 31) {
- res <<=
31
- 1;//shift this number to the left by 1 each time, so that eventually, this number is reversed
+ res <<= 1;//shift this number to the left by 1 each time, so that eventually, this number is reversed
32
}
33
34
return res;
0 commit comments