Chess board (4) X42055


Statement
 

pdf   zip

html

Write code for, given a non-negative integer n, where n=2k for some k ≥ 1, printing a chess board of size n, as shown in the examples.

The program must implement and use the CHESS-BOARD function, which can be iterative or recursive and is not allowed to perform input/output operations.

Make one submission with Python code and another submission with C++ code.

Input

The input is an integer n of the form n=2k for some k ≥ 1.

Output

The output is a chess board of size n.

Observation

The size n of a chess board is always of the form n=2k for some k ≥ 1.

Public test cases
  • Input

    2
    

    Output

    01
    10
    
  • Input

    4
    

    Output

    0101
    1010
    0101
    1010
    
  • Input

    8
    

    Output

    01010101
    10101010
    01010101
    10101010
    01010101
    10101010
    01010101
    10101010
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Official solutions
    C++ Python
    User solutions
    C++ Python