LeetCode 190, Easy. Topics: Divide and Conquer, Bit Manipulation. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 16 parametrized pytest cases, and a playground notebook:
Problem
Reverse bits of a given 32 bits signed integer.
Examples
Constraints
- 0 <= n <= 2^31 - 2
- n is even.
Follow up: If this function is called many times, how would you optimize it?
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
Grind, Blind 75, NeetCode 150, NeetCode 250, NeetCode All. Last modified on September 7, 2026