Foundations Loops through pattern printing
5. Square of Stars
Easy
Given an integer n, return the pattern below as a list of strings, one string per row, top row first.
The pattern is a square of stars: n rows, and each row holds exactly n stars (*) side by side, with no
spaces between them. A row has no spaces at the start or at the end.
Example 1
Input: n = 4
Output:
**** **** **** ****
Example 2
Input: n = 1
Output:
*Example 3
Input: n = 2
Output:
** **
Check your understanding
Work out the answer for this input before you write any code.
n = 3
Constraints
1 ≤ n ≤ 100
Clarifying questions
What you would ask an interviewer before writing any code.