Nested square (2) X39051


Statement
 

pdf   zip

html

Write code for, given a non-negative integer n, printing a nested square of size n, as shown in the examples.

The program must implement and use the NESTED-SQUARE function, which must be 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 ≥ 0.

Output

The output is a nested square of size n.

Public test cases
  • Input

    1
    

    Output

    *
    
  • Input

    2
    

    Output

    **
    **
    
  • Input

    12
    

    Output

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