Generation of Combinatorial Objects · Gray Codes

Lesson 3

Nikolai Chukhin · Alexander S. Kulikov

Programming problem.

Write a program that reads an integer \(1 \le n \le 10\) and outputs all binary sequences of length \(n\) such that every two adjacent sequences (as well as the first and last) differ in exactly one position.

5 points
Public samples
Public sample 1
Input
1
Expected output
0 1