We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4ed5d3 commit d0fafa4Copy full SHA for d0fafa4
reverse-bits/flynn.go
@@ -10,20 +10,20 @@ Big O
10
*/
11
12
func reverseBits(num uint32) uint32 {
13
- var res uint32 = 0
14
- for i := 0; i < 32; i++ {
+ var res uint32 = 0
+ for i := 0; i < 32; i++ {
15
// using numerical operators
16
// if num % 2 == 1 {
17
- // res = res * 2 + 1
18
- // } else {
19
- // res *= 2
20
- // }
21
- // num /= 2
+ // res = res * 2 + 1
+ // } else {
+ // res *= 2
+ // }
+ // num /= 2
22
23
// using bitwise operators
24
res = (res << 1) | (num & 1)
25
num >>= 1
26
- }
+ }
27
28
- return res
29
-}
+ return res
+}
0 commit comments