Skip to content
Onsite

End of Unit

EasyP3Coding

n is odd. Return n rows. The first row, the middle row (row (n + 1) / 2) and the last row are n stars separated by single spaces. Every other row is a single *. No row has trailing spaces.

For n = 5 the rows are * * * * *, *, * * * * *, *, * * * * *.

Example 1

Input
n = 5
Output
["* * * * *","*","* * * * *","*","* * * * *"]

Example 2

Input
n = 1
Output
["*"]
Why
With n = 1 the first, middle and last row are all the same row.

Example 3

Input
n = 3
Output
["* * *","* * *","* * *"]

Constraints

  • 1 <= n <= 99 and n is odd

Hints

Run checks the 3 visible tests, Submit all 8.