Hollow Square Architect
MediumAcc. 88.4%
+30 XP 12
Structural Integrity
A hollow square is a grid where only the boundary cells contain a character (*), and the inner cells are empty.
The Assignment
Your function receives a parameter size.
- Use nested loops (
ifor rows,jfor columns) from 0 tosize - 1. - If the current position is on the boundary (first row, last row, first column, or last column), print
*. - Otherwise, print a space.
- Correct spacing is essential: print a newline after each row.
01EXAMPLE 1
Input
size = 3Output
***
* *
***Explanation: A 3x3 hollow square.
Constraints
- Use nested loops.
- Only print symbols on the edges.
MathLoopsMastery
JavaScriptSystem handles I/O — write your function only
Loading...
2 Hidden
Input Arguments
size3
Expected Output
*** * * ***
Click RUN to test your solution