쉬움 0명 해결 정답률 0%

Hollow Square

Draw the outline of a square with * characters.

문제

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에 맞게 수정되었습니다. 위의 설명과 제한 조건을 따르세요.

다른 사람의 풀이 보기

커뮤니티 솔루션

아직 공개된 풀이가 없습니다. 문제를 풀고 첫 풀이를 공유하세요.