आसान 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 के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।