Loading...
Loading...
Loading...
A memory pool only accepts block sizes that are powers of two. Read a size and print yes if it is a power of two (1, 2, 4, 8, ...) and no otherwise.
yes or no.Example 1
Input
16
Output
yes
16 is 2 to the 4.
Example 2
Input
18
Output
no
Try the problem first. Open one hint at a time.
A power of two has exactly one 1 bit.
The expression n & (n - 1) removes the lowest 1 bit.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor