Introduction to Python

Powers of 2

Given a positive integer n, your task is to find all the powers of 2 that don’t exceed n.
Input
Output
51
1 2 4 8 16 32
 

Constraints

Time limit: 1 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue