आसान 0 हल किए गए 0% स्वीकृति

Pyramid Rows

Draw a right-aligned pyramid of # blocks.

समस्या

Draw a right-aligned pyramid like the one in Super Mario: row i (counting from 1) has height − i spaces followed by i # characters.

Implement pyramid_rows(height).

Input

height: The number of rows.

Output

Return the rows from top to bottom.

सीमाएँ

0 ≤ height ≤ 50

उदाहरण

उदाहरण 1
इनपुट:
height = 3

अपेक्षित आउटपुट:
expected = ["  #", " ##", "###"]
इनपुट:
long long height = 3;

अपेक्षित आउटपुट:
std::vector<std::string> expected = {"  #", " ##", "###"};
इनपुट:
long height = 3;

अपेक्षित आउटपुट:
string[] expected = new string[] {"  #", " ##", "###"};

व्याख्या

Rows are " #", " ##" and "###": each row has one more block and one less space.

उदाहरण 2
इनपुट:
height = 1

अपेक्षित आउटपुट:
expected = ["#"]
इनपुट:
long long height = 1;

अपेक्षित आउटपुट:
std::vector<std::string> expected = {"#"};
इनपुट:
long height = 1;

अपेक्षित आउटपुट:
string[] expected = new string[] {"#"};

व्याख्या

A single row with one block: "#".

संदर्भ

यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

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

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

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