| https://leetcode.com/problems/reverse-bits | Easy |
|---|
class Solution {
fun reverseBits(n: Int): Int {
var x = n
x = (x ushr 1 and 0x55555555) or ((x and 0x55555555) shl 1)
x = (x ushr 2 and 0x33333333) or ((x and 0x33333333) shl 2)
x = (x ushr 4 and 0x0f0f0f0f) or ((x and 0x0f0f0f0f) shl 4)
x = (x ushr 8 and 0x00ff00ff) or ((x and 0x00ff00ff) shl 8)
return (x ushr 16) or (x shl 16)
}
}