207. Binary Numbers 1 to N
EasyQueue
Print the binary representations of 1, 2, …, n, space-separated. (A queue generates them in order: start with 1 and append 0 and 1 to each.)
Input format
A single integer n.
Output format
n binary strings.
Example 1
Input
5
Output
1 10 11 100 101
Example 2
Input
1
Output
1
Constraints
1 ≤ n ≤ 10⁴
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…