Loading...
The Single Bit
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- junior, mid
Problem
A memory allocator needs to quickly verify that buffer sizes are valid powers of two before assigning them. Write a function that takes an integer and returns True if it is a positive power of two. Use bitwise operations.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.