0190 - Reverse Bits
Description (leetcode)
Reverse bits of a given 32 bits signed integer.
Example 1:
Input: n = 43261596
Output: 964176192
Explanation:
Example 2:
Input: n = 2147483644
Output: 1073741822
Explanation:
Constraints:
- 0 <= n <= 231 - 2
nis even.
Follow up: If this function is called many times, how would you optimize it?
submission
click to reveal
// let utilize the std
impl Solution {
pub fn reverse_bits(n: i32) -> i32 {
n.reverse_bits()
}
}