fb pixel

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
 
To check your solution you need to sign in
Sign in to continue