Entrevista a los 150 mejoresfácil

Bits inversos

Guía detallada e implementación de Python para el problema de 'Bits inversos'.

Declaración del problema

fácil

Bits inversos de un entero sin signo de 32 bits determinado.

Escribe una función reverseBits(n: int) -> int.

Restricciones
  • n must be a 32-bit unsigned integer

Ejemplos

Example 1
Input
n = 43261596
Output
964176192
Explanation

The input binary string 00000010100101000001111010011100 reversed is 00111001011110000010100101000000, representing 964176192.

Need a Hint?
Considere la posibilidad de utilizar estructuras de datos específicas de manipulación de bits, como conjuntos o montones.
Edge Cases to Watch
  • Estructuras de entrada vacías
  • Entradas de un solo elemento
  • Grandes límites numéricos

¿Listo para resolver?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Abrir en el editor
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

Recursos recomendados de Python

Amplíe sus conocimientos con tutoriales interactivos relacionados, hojas de trucos y comparaciones de códigos.