Einfach 0 gelöst 0% Erfolgsquote

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.

Einschränkungen

0 ≤ height ≤ 50

Beispiele

Beispiel 1
Eingabe:
height = 3

Erwartete Ausgabe:
expected = ["  #", " ##", "###"]
Eingabe:
long long height = 3;

Erwartete Ausgabe:
std::vector<std::string> expected = {"  #", " ##", "###"};
Eingabe:
long height = 3;

Erwartete Ausgabe:
string[] expected = new string[] {"  #", " ##", "###"};

Erläuterung

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

Beispiel 2
Eingabe:
height = 1

Erwartete Ausgabe:
expected = ["#"]
Eingabe:
long long height = 1;

Erwartete Ausgabe:
std::vector<std::string> expected = {"#"};
Eingabe:
long height = 1;

Erwartete Ausgabe:
string[] expected = new string[] {"#"};

Erläuterung

A single row with one block: "#".

Referenzen

Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.

Von anderen lernen

Community-Lösungen

Noch keine veröffentlichten Lösungen. Löse die Aufgabe und teile als Erster eine Lösung.