Loading...
Loading...
Loading...
A storage system allocates memory in blocks whose size must be a power of two (1, 2, 4, 8, ...). For each requested size print Yes if it is allowed and No if not.
Example 1
Input
4 1 6 8 12
Output
Yes No Yes No
Only 1 and 8.
Example 2
Input
2 64 65
Output
Yes No
Try the problem first. Open one hint at a time.
A power of two has exactly one 1 in its binary form.
x & (x - 1) clears the lowest 1, so it is 0 only for powers of two.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor