190. Reverse Bits
Solution
Implementation
class Solution {
fun reverseBits(n: Int): Int {
var num = n
var result = 0
for (i in 0 until 32) {
result = (result shl 1) or (num and 1)
num = num ushr 1
}
return result
}
}