Generation of Combinatorial Objects · Gray Codes
Lesson 5
Programming problem.
Write a program that reads an integer \(2 \le n \le 8\) and prints all binary sequences of length \(n\) such that every two adjacent sequences (as well as the first and the last) differ in at least \(n-1\) positions.
Public samples
Input
2
Expected output
00 11 10 01