問題
Draw a hollow square of side size: the first and last rows are all *, and the rows in between have * only at the two ends with spaces inside.
Implement hollow_square(size).
Input
size: The side length.
Output
Return the rows from top to bottom.
制約
1 ≤ size ≤ 50
例
例 1
入力:
size = 4
期待される出力:
expected = ["****", "* *", "* *", "****"]
入力:
long long size = 4;
期待される出力:
std::vector<std::string> expected = {"****", "* *", "* *", "****"};
入力:
long size = 4;
期待される出力:
string[] expected = new string[] {"****", "* *", "* *", "****"};
解説
Rows are "****", "* *", "* *", "****".
例 2
入力:
size = 1
期待される出力:
expected = ["*"]
入力:
long long size = 1;
期待される出力:
std::vector<std::string> expected = {"*"};
入力:
long size = 1;
期待される出力:
string[] expected = new string[] {"*"};
解説
A 1×1 square is a single "*".
参考資料
この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。